From: Tim Wiederhake Date: Mon, 19 Apr 2021 11:54:14 +0000 (+0200) Subject: cmdSnapshotList: Fix memory leak X-Git-Tag: v7.3.0-rc1~129 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89ce1ef86b0c8b0e039ae770221376497354f085;p=thirdparty%2Flibvirt.git cmdSnapshotList: Fix memory leak Fixes: 3caa28dc50df7ec215713075d669b20bef6473a2 Signed-off-by: Tim Wiederhake Reviewed-by: Laine Stump --- diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 2bec722c61..e64117785c 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -1497,7 +1497,6 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd) char *state = NULL; long long creation_longlong; g_autoptr(GDateTime) then = NULL; - g_autofree gchar *thenstr = NULL; bool tree = vshCommandOptBool(cmd, "tree"); bool name = vshCommandOptBool(cmd, "name"); bool from = vshCommandOptBool(cmd, "from"); @@ -1592,6 +1591,7 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd) } for (i = 0; i < snaplist->nsnaps; i++) { + g_autofree gchar *thenstr = NULL; const char *snap_name; /* free up memory from previous iterations of the loop */