[libvirt] [PATCH] 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 --- tools/virsh-edit.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/virsh-edit.c b/tools/virsh-edit.c index 9d612a3..bb79853 100644 --- a/tools/virsh-edit.c +++ b/tools/virsh-edit.c @@ -86,6 +86,7 @@ reedit: goto edit_cleanup; /* Read back the edited file. */ + VIR_FREE(doc_edited); doc_edited = vshEditReadBackFile(ctl, tmp); if (!doc_edited) goto edit_cleanup; @@ -102,6 +103,7 @@ redefine: * it was being edited? This also catches problems such as us * losing a connection or the object going away. */ + VIR_FREE(doc_reread); doc_reread = (EDIT_GET_XML); if (!doc_reread) goto edit_cleanup; -- 1.8.1.5

On 06/25/13 15:18, Ján Tomko wrote:
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 --- tools/virsh-edit.c | 2 ++ 1 file changed, 2 insertions(+)
ACK. Peter

On 06/25/2013 03:38 PM, Peter Krempa wrote:
On 06/25/13 15:18, Ján Tomko wrote:
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 --- tools/virsh-edit.c | 2 ++ 1 file changed, 2 insertions(+)
ACK.
Peter
Thanks, pushed now. Jan
participants (2)
-
Ján Tomko
-
Peter Krempa