rpm/backport-Fix-Header-leak-when-running-rpm2cpio.patch
xujing 72402da4ec backport patches from upstream to fix memleak
(cherry picked from commit db558dc55a22b2cf651315c1aadbbcf595e55bf8)
2022-12-20 09:54:53 +08:00

30 lines
814 B
Diff

From cf27c6f4963dcf27302d0f4fa39d7787dd03f942 Mon Sep 17 00:00:00 2001
From: xujing <xujing125@huawei.com>
Date: Fri, 25 Nov 2022 17:18:33 +0800
Subject: [PATCH] Fix Header leak when running rpm2cpio
Header "h" is alloced in rpmReadPackageFile but not freed when
running rpm2cpio. Fix it. Remove redundant whitespace between
the Fclose()'s too while at it for logical cleanup grouping.
---
rpm2cpio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rpm2cpio.c b/rpm2cpio.c
index fcc3b3079..940d6ce38 100644
--- a/rpm2cpio.c
+++ b/rpm2cpio.c
@@ -96,8 +96,8 @@ int main(int argc, char *argv[])
*/
rc = (ufdCopy(gzdi, fdo) >= payload_size) ? EXIT_SUCCESS : EXIT_FAILURE;
+ headerFree(h);
Fclose(fdo);
-
Fclose(gzdi); /* XXX gzdi == fdi */
return rc;
--
2.33.0