This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Free errstring if _dl_addr returns 0
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Fri, 7 Sep 2012 11:47:37 -0700
- Subject: [PATCH] Free errstring if _dl_addr returns 0
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
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