]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virbitmaptest: Shut coverity up in case of broken test
authorPeter Krempa <pkrempa@redhat.com>
Mon, 19 Aug 2013 12:02:52 +0000 (14:02 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 19 Aug 2013 13:54:43 +0000 (15:54 +0200)
Coverity reported a memleak in the test added in 7efd5fd1b02. In case
the code will be broken and the code will actually parse a faulty bitmap
the resulting pointer would be leaked. Free it although that shouldn't
ever happen.

tests/virbitmaptest.c

index c56d6fa284921273bfe16559256ee1fd73e81c18..7ec78fdad450f9b02037ddc1d1525c5ee200d340 100644 (file)
@@ -470,7 +470,7 @@ static int
 test9(const void *opaque ATTRIBUTE_UNUSED)
 {
     int ret = -1;
-    virBitmapPtr bitmap;
+    virBitmapPtr bitmap = NULL;
 
     if (virBitmapParse("100000000", 0, &bitmap, 20) != -1)
         goto cleanup;
@@ -492,6 +492,7 @@ test9(const void *opaque ATTRIBUTE_UNUSED)
 
     ret = 0;
 cleanup:
+    virBitmapFree(bitmap);
     return ret;
 
 }