[libvirt] [PATCH RESEND] virpcimock: Fix memory leak in pci_driver_new

ZhiPeng Lu posted 1 patch 6 years, 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1500089736-4003-1-git-send-email-lu.zhipeng@zte.com.cn
tests/virpcimock.c | 1 +
1 file changed, 1 insertion(+)
[libvirt] [PATCH RESEND] virpcimock: Fix memory leak in pci_driver_new
Posted by ZhiPeng Lu 6 years, 9 months ago
@driverpath, allocated by virAsprintfQuiet, was not freed and leaked.

Signed-off-by: Zhipeng Lu <lu.zhipeng@zte.com.cn>
---
 tests/virpcimock.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/virpcimock.c b/tests/virpcimock.c
index e9408aa..dec9e01 100644
--- a/tests/virpcimock.c
+++ b/tests/virpcimock.c
@@ -480,6 +480,7 @@ pci_driver_new(const char *name, int fail, ...)
 
     if (VIR_APPEND_ELEMENT_QUIET(pciDrivers, nPCIDrivers, driver) < 0)
         ABORT_OOM();
+    VIR_FREE(driverpath);
 }
 
 static struct pciDriver *
-- 
1.8.3.1


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH RESEND] virpcimock: Fix memory leak in pci_driver_new
Posted by Laine Stump 6 years, 9 months ago
On 07/14/2017 11:35 PM, ZhiPeng Lu wrote:
> @driverpath, allocated by virAsprintfQuiet, was not freed and leaked.
>
> Signed-off-by: Zhipeng Lu <lu.zhipeng@zte.com.cn>

ACK and pushed. Thanks!

> ---
>  tests/virpcimock.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tests/virpcimock.c b/tests/virpcimock.c
> index e9408aa..dec9e01 100644
> --- a/tests/virpcimock.c
> +++ b/tests/virpcimock.c
> @@ -480,6 +480,7 @@ pci_driver_new(const char *name, int fail, ...)
>  
>      if (VIR_APPEND_ELEMENT_QUIET(pciDrivers, nPCIDrivers, driver) < 0)
>          ABORT_OOM();
> +    VIR_FREE(driverpath);
>  }
>  
>  static struct pciDriver *


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list