This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Free errstring if _dl_addr returns 0


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]