wuyuoss / rpms / rpm

Forked from rpms/rpm 3 years ago
Clone

Blame SOURCES/0001-Fix-memleak-during-transaction-verify-step-in-the-NO.patch

83a7c7
From 5188a7b35eb3672c9b15e96433e033ee36f8e6a8 Mon Sep 17 00:00:00 2001
83a7c7
From: Panu Matilainen <pmatilai@redhat.com>
83a7c7
Date: Tue, 6 Aug 2019 13:06:16 +0300
83a7c7
Subject: [PATCH] Fix memleak during transaction verify step in the NOKEY case.
83a7c7
83a7c7
Found during RhBug:1714657 QA testing.
83a7c7
In addition, add a comment to clarify the fallthrough as intentional.
83a7c7
---
83a7c7
 lib/transaction.c | 4 +++-
83a7c7
 1 file changed, 3 insertions(+), 1 deletion(-)
83a7c7
83a7c7
diff --git a/lib/transaction.c b/lib/transaction.c
83a7c7
index 6e4d4be65..e51cff25a 100644
83a7c7
--- a/lib/transaction.c
83a7c7
+++ b/lib/transaction.c
83a7c7
@@ -1226,8 +1226,10 @@ static int vfyCb(struct rpmsinfo_s *sinfo, void *cbdata)
83a7c7
 	 */
83a7c7
 	if (!(vd->vfylevel & RPMSIG_SIGNATURE_TYPE))
83a7c7
 	    sinfo->rc = RPMRC_OK;
83a7c7
+	/* fallthrough */
83a7c7
     default:
83a7c7
-	vd->msg = rpmsinfoMsg(sinfo);
83a7c7
+	if (sinfo->rc)
83a7c7
+	    vd->msg = rpmsinfoMsg(sinfo);
83a7c7
 	break;
83a7c7
     }
83a7c7
     return (sinfo->rc == 0);
83a7c7
-- 
83a7c7
2.21.0
83a7c7