[libvirt PATCH] vsh: fix memory leak in vshCommandParse

Ján Tomko posted 1 patch 6 days, 17 hours ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/6a38a1c01dc5993600f9e8dba2d2819bc7578545.1617809308.git.jtomko@redhat.com
tools/vsh.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

[libvirt PATCH] vsh: fix memory leak in vshCommandParse

Posted by Ján Tomko 6 days, 17 hours ago
One of the error branches used a plain free where vshCommandFree
was required.

https://bugzilla.redhat.com/show_bug.cgi?id=1943415

Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 tools/vsh.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/vsh.c b/tools/vsh.c
index 552ed29ab9..d9c0a9b80d 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -1530,7 +1530,7 @@ vshCommandParse(vshControl *ctl, vshCommandParser *parser, vshCmd **partial)
 
             if (!partial &&
                 vshCommandCheckOpts(ctl, c, opts_required, opts_seen) < 0) {
-                VIR_FREE(c);
+                vshCommandFree(c);
                 goto syntaxError;
             }
 
-- 
2.29.2

Re: [libvirt PATCH] vsh: fix memory leak in vshCommandParse

Posted by Erik Skultety 6 days, 2 hours ago
On Wed, Apr 07, 2021 at 05:29:50PM +0200, Ján Tomko wrote:
> One of the error branches used a plain free where vshCommandFree
> was required.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1943415
> 
> Signed-off-by: Ján Tomko <jtomko@redhat.com>
> ---
Reviewed-by: Erik Skultety <eskultet@redhat.com>