[PATCH] Free errstring if _dl_addr returns 0
H.J. Lu
hongjiu.lu@intel.com
Fri Sep 7 18:47:00 GMT 2012
Hi,
_dl_addr retuns 0 when shared object is found. This indicates static
executable and we should free the buffer. OK to install?
Thanks.
H.J.
---
* dlfcn/dlerror.c (check_free): Free errstring if _dl_addr
returns 0.
diff --git a/dlfcn/dlerror.c b/dlfcn/dlerror.c
index 8138cc2..4c7ca87 100644
--- a/dlfcn/dlerror.c
+++ b/dlfcn/dlerror.c
@@ -193,8 +193,8 @@ check_free (struct dl_action_result *rec)
always the C library in the base namespave. */
struct link_map *map = NULL;
Dl_info info;
- if (_dl_addr (check_free, &info, &map, NULL) != 0
- && map != NULL && map->l_ns == 0)
+ if (_dl_addr (check_free, &info, &map, NULL) == 0
+ || (map != NULL && map->l_ns == 0))
free ((char *) rec->errstring);
}
}
--
1.7.11.4
More information about the Libc-alpha
mailing list