cmdSnapshotList: Fix memory leak

Fixes: 3caa28dc50
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
Tim Wiederhake 2021-04-19 13:54:14 +02:00 committed by Laine Stump
parent 8b8c91f487
commit 89ce1ef86b

View File

@ -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 */