[libvirt] [PATCH] util: Resolve resource leak

John Ferlan posted 1 patch 6 years, 6 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20171011210305.28308-1-jferlan@redhat.com
src/util/vircommand.c | 1 +
1 file changed, 1 insertion(+)
[libvirt] [PATCH] util: Resolve resource leak
Posted by John Ferlan 6 years, 6 months ago
Need to free @groups in the parent on success similar to other
APIs (virFile*) which use virGetGroupList and virFork.

Reported by Coverity.

Signed-off-by: John Ferlan <jferlan@redhat.com>
---
 src/util/vircommand.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 41a61da49f..6cd76a560e 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -606,6 +606,7 @@ virExec(virCommandPtr cmd)
 
         cmd->pid = pid;
 
+        VIR_FREE(groups);
         VIR_FREE(binarystr);
 
         return 0;
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] util: Resolve resource leak
Posted by Erik Skultety 6 years, 6 months ago
On Wed, Oct 11, 2017 at 05:03:05PM -0400, John Ferlan wrote:
> Need to free @groups in the parent on success similar to other
> APIs (virFile*) which use virGetGroupList and virFork.
>
> Reported by Coverity.
>
> Signed-off-by: John Ferlan <jferlan@redhat.com>
> ---
>  src/util/vircommand.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/util/vircommand.c b/src/util/vircommand.c
> index 41a61da49f..6cd76a560e 100644
> --- a/src/util/vircommand.c
> +++ b/src/util/vircommand.c
> @@ -606,6 +606,7 @@ virExec(virCommandPtr cmd)
>
>          cmd->pid = pid;
>
> +        VIR_FREE(groups);
>          VIR_FREE(binarystr);
>
>          return 0;

Reviewed-by: Erik Skultety <eskultet@redhat.com>

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