提交 788e6cb2 编写于 作者: P Pavel Hrdina

Fix possible memory leak in phyp_driver.c

There could be a memory leak caused by "managed_system" string, if any
error occurs before "managed_system" is assigned into
"phyp_driver->managed_system". The "managed_system" string wouldn't be
freed at all. The better way is to free the "managed_system" instead
of the one assigned in the "phyp_driver".

This has been found by coverity.

Pointed out by John, that the "phyp_driver->xmlopt" needs to be
unreferenced as well.
Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
上级 7ed02a00
......@@ -1153,9 +1153,11 @@ phypConnectOpen(virConnectPtr conn,
return VIR_DRV_OPEN_SUCCESS;
failure:
VIR_FREE(managed_system);
if (phyp_driver != NULL) {
virObjectUnref(phyp_driver->caps);
VIR_FREE(phyp_driver->managed_system);
virObjectUnref(phyp_driver->xmlopt);
VIR_FREE(phyp_driver);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册