The cleanup path in virsh-edit helper was never reached when the edit
was successful leaking the document in memory as well as the temporary
file.
char *doc_edited = NULL;
char *doc_reread = NULL;
const char *msg = NULL;
+ bool edit_success = false;
/* Get the XML configuration of the object. */
doc = (EDIT_GET_XML);
}
}
- break;
+ edit_success = true;
edit_cleanup:
VIR_FREE(doc);
unlink (tmp);
VIR_FREE(tmp);
}
- goto cleanup;
+
+ if (!edit_success)
+ goto cleanup;
} while (0);