[libvirt] [PATCH] node_device: fix memory leak in nodeDeviceSysfsGetSCSIHostCaps

Erik Skultety eskultet at redhat.com
Fri May 26 11:23:58 UTC 2017


On Thu, May 25, 2017 at 10:39:48PM -0400, Yi Wang wrote:
> The @tmp is allocated in virVHBAGetConfig in virVHBAIsVportCapable
> condition, it will lost when virVHBAGetConfig called again.
>
> Signed-off-by: Yi Wang <wang.yi59 at zte.com.cn>
> ---
>  src/node_device/node_device_linux_sysfs.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/node_device/node_device_linux_sysfs.c b/src/node_device/node_device_linux_sysfs.c
> index 1b7aa94..a9c7c9c 100644
> --- a/src/node_device/node_device_linux_sysfs.c
> +++ b/src/node_device/node_device_linux_sysfs.c
> @@ -95,7 +95,8 @@ nodeDeviceSysfsGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host)
>              goto cleanup;
>          }
>
> -         if (!(tmp = virVHBAGetConfig(NULL, scsi_host->host,
> +        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);
> --

ACK

I tweaked the commit message a bit, fixed the broken indentation (introduced
prior to your patch - your patch actually made it more visible) and pushed.

Thanks,
Erik

> 1.8.3.1
>
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list




More information about the libvir-list mailing list