alexk / rpms / rpm

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