From 7fcdfd3b40f69af6a1d4980683859eef05f39b4e Mon Sep 17 00:00:00 2001
From: xujing <xujing125@huawei.com>
Date: Fri, 25 Nov 2022 16:48:34 +0800
Subject: [PATCH 1/5] Fix BANames leak in handlePreambleTag

The "BANames" is alloced from popParseArgvString but not freed
when spec->packages != pkg. Fix it.
---
 build/parsePreamble.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/build/parsePreamble.c b/build/parsePreamble.c
index 119551cf6..c4d137cf7 100644
--- a/build/parsePreamble.c
+++ b/build/parsePreamble.c
@@ -961,6 +961,7 @@ static rpmRC handlePreambleTag(rpmSpec spec, Package pkg, rpmTagVal tag,
 		BANames = _free(BANames);
 		goto exit;
 	    }
+	    BANames = _free(BANames);
 	    headerPutString(pkg->header, RPMTAG_ARCH, "noarch");
 	}
 	if (!BACount)
-- 
2.27.0

