summaryrefslogtreecommitdiff
path: root/libdwfl/dwfl_module.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2007-10-23 13:07:39 +0000
committerRoland McGrath <roland@redhat.com>2007-10-23 13:07:39 +0000
commite4c22ea004c02a58f5db5eb53794275344c17958 (patch)
treeec3713d305f8e9f05b15d29240accc71e98998c5 /libdwfl/dwfl_module.c
parent98c5ead4ad9fbf96ad3b54d8ca26e354ddc3398d (diff)
downloadelfutils-e4c22ea004c02a58f5db5eb53794275344c17958.tar.gz
2007-10-23 Roland McGrath <roland@redhat.com>
* linux-kernel-modules.c (report_kernel_archive): Reorder the kernel module to appear first.
Diffstat (limited to 'libdwfl/dwfl_module.c')
-rw-r--r--libdwfl/dwfl_module.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/libdwfl/dwfl_module.c b/libdwfl/dwfl_module.c
index 4cee37c2..434f3ff9 100644
--- a/libdwfl/dwfl_module.c
+++ b/libdwfl/dwfl_module.c
@@ -68,12 +68,10 @@ static void
free_file (struct dwfl_file *file)
{
free (file->name);
- if (file->elf != NULL)
- {
- elf_end (file->elf);
- if (file->fd != -1)
- close (file->fd);
- }
+
+ /* Close the fd only on the last reference. */
+ if (file->elf != NULL && elf_end (file->elf) == 0 && file->fd != -1)
+ close (file->fd);
}
void