]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdwfl: Don't leak fname if file is main file by another name in try_open.
authorMark Wielaard <mjw@redhat.com>
Thu, 18 Jun 2015 14:17:40 +0000 (16:17 +0200)
committerMark Wielaard <mjw@redhat.com>
Fri, 19 Jun 2015 11:09:42 +0000 (13:09 +0200)
Signed-off-by: Mark Wielaard <mjw@redhat.com>
libdwfl/ChangeLog
libdwfl/find-debuginfo.c

index ca987833a7f56887760ffe6fa239582742b5d87f..5059be6d24d699dad03c8a25c02b8298468140ff 100644 (file)
@@ -1,3 +1,7 @@
+2015-06-18  Mark Wielaard  <mjw@redhat.com>
+
+       * find-debuginfo.c (try_open): Free fname on all failure paths.
+
 2015-06-18  Mark Wielaard  <mjw@redhat.com>
 
        * dwfl_module_getdwarf.c (find_symtab): Check shdr is not NULL and
index c5233548014b5ea8f19df8b6d53fa087b03043bc..1faa494d841ee76e305a2f7a44d11bba92a20921 100644 (file)
@@ -1,5 +1,5 @@
 /* Standard find_debuginfo callback for libdwfl.
-   Copyright (C) 2005-2010, 2014 Red Hat, Inc.
+   Copyright (C) 2005-2010, 2014, 2015 Red Hat, Inc.
    This file is part of elfutils.
 
    This file is free software; you can redistribute it and/or modify
@@ -62,6 +62,7 @@ try_open (const struct stat64 *main_stat,
           && st.st_dev == main_stat->st_dev)
     {
       /* This is the main file by another name.  Don't look at it again.  */
+      free (fname);
       close (fd);
       errno = ENOENT;
       fd = -1;