]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
src/elfclassify.c: Fix memory leak in check_ar_members
authorAaron Merey <amerey@redhat.com>
Tue, 3 Feb 2026 21:31:00 +0000 (16:31 -0500)
committerAaron Merey <amerey@redhat.com>
Tue, 10 Feb 2026 22:55:36 +0000 (17:55 -0500)
If current_path needs to be reallocated, full_path is assigned a newly
malloced buffer and then full_path is assigned to current_path.  This
leaks the previous value of full_path.

Free full_path before reassigning it.

Signed-off-by: Aaron Merey <amerey@redhat.com>
src/elfclassify.c

index 307771b23a71999ebd4006ed63269abf1befe419..80a376a4945988a772046faa0d93f80d7f31189f 100644 (file)
@@ -866,6 +866,8 @@ check_ar_members (void)
              bad_ar = true;
              break;
            }
+
+         free (full_path);
          full_path = new_path;
        }