]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vshCommandParse: placate coverity
authorJim Meyering <meyering@redhat.com>
Tue, 16 Feb 2010 13:34:48 +0000 (14:34 +0100)
committerJim Meyering <meyering@redhat.com>
Tue, 16 Feb 2010 17:17:44 +0000 (18:17 +0100)
There is no real leak here, but Coverity-Prevent thinks there is.
It does not see that while there are four ways to return from
vshCommandGetToken with VSH_TK_END, none of them results in allocation
of a result.
* tools/virsh.c (vshCommandParse): Add a (currently) useless VIR_FREE,
to ensure that we never leak when vshCommandGetToken returns VSH_TK_END.

tools/virsh.c

index 7db48d972aa0378ac698e89a2c1f4835e96fd265..4ffa154dc7920c8084bda8afa474e5181a296fe3 100644 (file)
@@ -8222,8 +8222,10 @@ vshCommandParse(vshControl *ctl, char *cmdstr)
 
             str = end;
 
-            if (tk == VSH_TK_END)
+            if (tk == VSH_TK_END) {
+                VIR_FREE(tkdata);
                 break;
+            }
             if (tk == VSH_TK_ERROR)
                 goto syntaxError;