提交 1035c51f 编写于 作者: P Peter Krempa

virsh: Fix resource leaks when editing files.

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.
上级 03da89d1
......@@ -68,6 +68,7 @@ do {
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);
......@@ -139,7 +140,7 @@ redefine:
}
}
break;
edit_success = true;
edit_cleanup:
VIR_FREE(doc);
......@@ -149,7 +150,9 @@ edit_cleanup:
unlink (tmp);
VIR_FREE(tmp);
}
goto cleanup;
if (!edit_success)
goto cleanup;
} while (0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册