[PATCH 2/4] debugedit-classify-ar: Close elf after elf_getarhdr fail in classify_ar_elf

Mark Wielaard mark@klomp.org
Mon May 18 12:43:15 GMT 2026


Would leak Elf handle otherwise. Although we will quit failure soon
afterwards.

	* tools/debugedit-classify-ar.c (classify_ar_elf): Call
	elf_end on failure.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 tools/debugedit-classify-ar.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/debugedit-classify-ar.c b/tools/debugedit-classify-ar.c
index 55633c2bd5f0..ae434f7a3d1a 100644
--- a/tools/debugedit-classify-ar.c
+++ b/tools/debugedit-classify-ar.c
@@ -123,6 +123,7 @@ classify_ar_elf (int fd, Elf *ar, const char *file)
 	    error (0, 0, "couldn't get ar header: %s: '%s'",
 		   elf_errmsg (-1), file);
 	  err = true;
+	  elf_end (elf);
 	  break;
 	}
 
-- 
2.53.0



More information about the Debugedit mailing list