[libvirt] [PATCH] qemu: Using virStringListFreeCount instead VIR_FREE to free tmpPaths.

Julio Faracco posted 1 patch 7 years, 2 months ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20181114173231.19181-1-jcfaracco@gmail.com
src/qemu/qemu_domain.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[libvirt] [PATCH] qemu: Using virStringListFreeCount instead VIR_FREE to free tmpPaths.
Posted by Julio Faracco 7 years, 2 months ago
The function qemuDomainGetHostdevPath() is using VIR_FREE to free the
paths stored in tmpPaths. Both syntax analyzer are reporting a warning
about this. Replacing the old method to function
virStringListFreeCount() fixes the warnings/errors.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
---
 src/qemu/qemu_domain.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 37926850b2..c374219aab 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11132,9 +11132,7 @@ qemuDomainGetHostdevPath(virDomainDefPtr def,
     }
     ret = 0;
  cleanup:
-    for (i = 0; i < tmpNpaths; i++)
-        VIR_FREE(tmpPaths[i]);
-    VIR_FREE(tmpPaths);
+    virStringListFreeCount(tmpPaths, tmpNpaths);
     VIR_FREE(tmpPerms);
     virPCIDeviceFree(pci);
     virUSBDeviceFree(usb);
-- 
2.19.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Using virStringListFreeCount instead VIR_FREE to free tmpPaths.
Posted by John Ferlan 7 years, 2 months ago

On 11/14/18 12:32 PM, Julio Faracco wrote:
> The function qemuDomainGetHostdevPath() is using VIR_FREE to free the
> paths stored in tmpPaths. Both syntax analyzer are reporting a warning
> about this. Replacing the old method to function
> virStringListFreeCount() fixes the warnings/errors.
> 
> Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
> ---
>  src/qemu/qemu_domain.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 

Reviewed-by: John Ferlan <jferlan@redhat.com>

John

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