]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Resolve Coverity FORWARD_NULL
authorJohn Ferlan <jferlan@redhat.com>
Thu, 11 Sep 2014 21:45:04 +0000 (17:45 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Fri, 12 Sep 2014 10:12:50 +0000 (06:12 -0400)
If we end up at the cleanup lable before we've VIR_EXPAND_N the list,
then calling virQEMUCapsFreeStringList() with a NULL proplist could
theoretically deref proplist if nproplist was set. Coverity doesn't
seem to acknowledge the relationship between proplist and nproplist
assuming in virQEMUCapsFreeStringList that nproplist could be at
least 1 and thus have a null deref.  It only seems to follow the
NULL proplist.

Signed-off-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_capabilities.c

index a652f29db8045ca5316e81747c8033ec1da7adad..81ada486f10416b3d4a46a66d34d417906758935 100644 (file)
@@ -1728,7 +1728,7 @@ virQEMUCapsParseDeviceStrObjectProps(const char *str,
     ret = nproplist;
 
  cleanup:
-    if (ret < 0)
+    if (ret < 0 && proplist)
         virQEMUCapsFreeStringList(nproplist, proplist);
     return ret;
 }