From: Mark Wielaard Date: Thu, 18 Jun 2015 14:17:40 +0000 (+0200) Subject: libdwfl: Don't leak fname if file is main file by another name in try_open. X-Git-Tag: elfutils-0.163~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9075ff6aebb67d9ef2a5b53d1ae35c55590edcf7;p=thirdparty%2Felfutils.git libdwfl: Don't leak fname if file is main file by another name in try_open. Signed-off-by: Mark Wielaard --- diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index ca987833a..5059be6d2 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,7 @@ +2015-06-18 Mark Wielaard + + * find-debuginfo.c (try_open): Free fname on all failure paths. + 2015-06-18 Mark Wielaard * dwfl_module_getdwarf.c (find_symtab): Check shdr is not NULL and diff --git a/libdwfl/find-debuginfo.c b/libdwfl/find-debuginfo.c index c52335480..1faa494d8 100644 --- a/libdwfl/find-debuginfo.c +++ b/libdwfl/find-debuginfo.c @@ -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;