mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 23:37:42 +00:00
virsh: edit: don't leak XML string on reedit or redefine
Free the old XML strings before overwriting them if the user has chosen to reedit the file or force the redefinition. Found by Alex Jia trying to reproduce another bug: https://bugzilla.redhat.com/show_bug.cgi?id=977430#c3 (cherry picked from commit 1e3a252974c8e5c650f1d84dc2b167f0ae8cee3c)
This commit is contained in:
parent
f90b024957
commit
ad62d2c70f
@ -86,6 +86,7 @@ reedit:
|
|||||||
goto edit_cleanup;
|
goto edit_cleanup;
|
||||||
|
|
||||||
/* Read back the edited file. */
|
/* Read back the edited file. */
|
||||||
|
VIR_FREE(doc_edited);
|
||||||
doc_edited = vshEditReadBackFile(ctl, tmp);
|
doc_edited = vshEditReadBackFile(ctl, tmp);
|
||||||
if (!doc_edited)
|
if (!doc_edited)
|
||||||
goto edit_cleanup;
|
goto edit_cleanup;
|
||||||
@ -102,6 +103,7 @@ redefine:
|
|||||||
* it was being edited? This also catches problems such as us
|
* it was being edited? This also catches problems such as us
|
||||||
* losing a connection or the object going away.
|
* losing a connection or the object going away.
|
||||||
*/
|
*/
|
||||||
|
VIR_FREE(doc_reread);
|
||||||
doc_reread = (EDIT_GET_XML);
|
doc_reread = (EDIT_GET_XML);
|
||||||
if (!doc_reread)
|
if (!doc_reread)
|
||||||
goto edit_cleanup;
|
goto edit_cleanup;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user