提交 1e3a2529 编写于 作者: J Ján Tomko

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
上级 f3d08aa0
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册