__libdwfl_report_elf: Return NULL on overlap, don't (double) close elf.
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 97e888f..f2348e2 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,7 @@
+2009-06-18  Mark Wielaard  <mjw@redhat.com>
+
+	* dwfl_report_elf.c (__libdwfl_report_elf): Return NULL on overlap.
+
 2009-06-13  Ulrich Drepper  <drepper@redhat.com>
 
 	* derelocate.c: Don't use deprecated libelf functions.
diff --git a/libdwfl/dwfl_report_elf.c b/libdwfl/dwfl_report_elf.c
index a58d302..52b0c57 100644
--- a/libdwfl/dwfl_report_elf.c
+++ b/libdwfl/dwfl_report_elf.c
@@ -235,11 +235,10 @@
       else if ((fd >= 0 && m->main.fd != fd)
 	       || strcmp (m->main.name, file_name))
 	{
-	  elf_end (elf);
 	overlap:
 	  m->gc = true;
 	  __libdwfl_seterrno (DWFL_E_OVERLAP);
-	  m = NULL;
+	  return NULL;
 	}
 
       /* Preinstall the open ELF handle for the module.  */