From 4b830f7b5a4a70a53e2eef63baf82b7fff308a3c Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Fri, 11 Oct 2024 14:26:57 +0300
Subject: [PATCH] Fix a memory leak on rpmdb --importdb

Conflict:modify rpmdb.c instead of tools/rpmdb.cc
Reference:https://github.com/rpm-software-management/rpm/commit/4b830f7b5a4a70a53e2eef63baf82b7fff308a3c

---
 rpmdb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/rpmdb.c b/rpmdb.c
index 20d5d67bd..1736e1ef7 100644
--- a/rpmdb.c
+++ b/rpmdb.c
@@ -79,6 +79,7 @@ static int importDB(rpmts ts)
 	Header h;
 	while ((h = headerRead(fd, HEADER_MAGIC_YES))) {
 	    rc += rpmtsImportHeader(txn, h, 0);
+	    headerFree(h);
 	}
     } else {
 	rc = -1;
-- 
2.33.0

