cmdCheckpointList: 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:13 +02:00 committed by Laine Stump
parent 1294de209c
commit 8b8c91f487

View File

@ -721,7 +721,6 @@ cmdCheckpointList(vshControl *ctl,
virDomainCheckpointPtr checkpoint = NULL; virDomainCheckpointPtr checkpoint = NULL;
long long creation_longlong; long long creation_longlong;
g_autoptr(GDateTime) then = NULL; g_autoptr(GDateTime) then = NULL;
g_autofree gchar *thenstr = NULL;
bool tree = vshCommandOptBool(cmd, "tree"); bool tree = vshCommandOptBool(cmd, "tree");
bool name = vshCommandOptBool(cmd, "name"); bool name = vshCommandOptBool(cmd, "name");
bool from = vshCommandOptBool(cmd, "from"); bool from = vshCommandOptBool(cmd, "from");
@ -804,6 +803,7 @@ cmdCheckpointList(vshControl *ctl,
} }
for (i = 0; i < checkpointlist->nchks; i++) { for (i = 0; i < checkpointlist->nchks; i++) {
g_autofree gchar *thenstr = NULL;
const char *chk_name; const char *chk_name;
/* free up memory from previous iterations of the loop */ /* free up memory from previous iterations of the loop */