libdwfl: Don't leak fname if file is main file by another name in try_open.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
This commit is contained in:
Mark Wielaard
2015-06-18 16:17:40 +02:00
parent 90a7bd23b1
commit 9075ff6aeb
2 changed files with 6 additions and 1 deletions
+4
View 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
+2 -1
View 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;