commit c4f133 libdwfl: find_debuginfo_in_patch don't alloca/strdupa
strings of unknown size. Introduced a memory leak in the case nothing
was found. Make sure before returning all temporary strings are all
freed.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
+2015-06-06 Mark Wielaard <mjw@redhat.com>
+
+ * find-debuginfo.c (find_debuginfo_in_path): Always free localpath,
+ localname and file_dirname.
+
2015-06-06 Mark Wielaard <mjw@redhat.com>
* derelocate.c (cache_sections): Free sortrefs.
}
continue;
default:
- {
- fail_free:
- free (localpath);
- free (localname);
- free (file_dirname);
- return -1;
- }
+ goto fail_free;
}
- free (localpath);
- free (localname);
- free (file_dirname);
if (validate (mod, fd, check, debuglink_crc))
{
+ free (localpath);
+ free (localname);
+ free (file_dirname);
*debuginfo_file_name = fname;
return fd;
}
/* No dice. */
errno = 0;
+fail_free:
+ free (localpath);
+ free (localname);
+ free (file_dirname);
return -1;
}