From 688c4ad34d197055eb8f58fb4e45065af881598c Mon Sep 17 00:00:00 2001
From: xujing <xujing125@huawei.com>
Date: Mon, 28 Nov 2022 11:10:19 +0800
Subject: [PATCH 1/3] Fix memleak when fsmRename failed in fsmCommit

The "dest" is alloced in fsmFsPath but not freed when fsmRename failed
in fsmCommit. Fix it.
---
 lib/fsm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/fsm.c b/lib/fsm.c
index 7987abbc9..e38155df7 100644
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -782,7 +782,8 @@ static int fsmCommit(int dirfd, char **path, rpmfi fi, rpmFileAction action, con
 		}
 		free(*path);
 		*path = dest;
-	    }
+	    } else
+		free(dest);
 	}
     }
 
-- 
2.27.0

