]> xenbits.xensource.com Git - libvirt.git/commitdiff
cmdSnapshotList: Fix memory leak
authorTim Wiederhake <twiederh@redhat.com>
Mon, 19 Apr 2021 11:54:14 +0000 (13:54 +0200)
committerLaine Stump <laine@redhat.com>
Mon, 19 Apr 2021 20:09:56 +0000 (16:09 -0400)
Fixes: 3caa28dc50df7ec215713075d669b20bef6473a2
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
tools/virsh-snapshot.c

index 2bec722c61469eb0f7f33676973c905301a8e865..e64117785c00ed57b28ca4fc9c97b1fb67d2613b 100644 (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 */