node_device: fix memory leak in nodeDeviceSysfsGetSCSIHostCaps

@tmp is leaked after the second call to virVHBAGetConfig within
virVHBAIsVportCapable code block because it wasn't freed after making the
first call to the function.

Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Yi Wang 2017-05-25 22:39:48 -04:00 committed by Erik Skultety
parent 9f4c39f309
commit d190424105

View File

@ -95,8 +95,9 @@ nodeDeviceSysfsGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host)
goto cleanup;
}
if (!(tmp = virVHBAGetConfig(NULL, scsi_host->host,
"npiv_vports_inuse"))) {
VIR_FREE(tmp);
if (!(tmp = virVHBAGetConfig(NULL, scsi_host->host,
"npiv_vports_inuse"))) {
VIR_WARN("Failed to read npiv_vports_inuse for host%d",
scsi_host->host);
goto cleanup;