]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: fix virBitmap allocation in virProcessInfoGetAffinity
authorJán Tomko <jtomko@redhat.com>
Thu, 29 Nov 2012 09:56:56 +0000 (10:56 +0100)
committerCole Robinson <crobinso@redhat.com>
Sun, 9 Dec 2012 21:53:40 +0000 (16:53 -0500)
Found by coverity:
Error: REVERSE_INULL (CWE-476):
    libvirt-0.10.2/src/util/processinfo.c:141: deref_ptr: Directly
    dereferencing pointer "map".
    libvirt-0.10.2/src/util/processinfo.c:142: check_after_deref:
    Null-checking "map" suggests that it may be null, but it has already
    been dereferenced on all paths leading to the check.
(cherry picked from commit 7730257db30972a6f4db8d582b232b240b2a06b8)

src/util/processinfo.c

index d4f8f4b672b98bada24d20fe6562574c5c6cbc1b..165023aec30570baf43bfaaac83f344ba9701299 100644 (file)
@@ -139,7 +139,7 @@ realloc:
     }
 
     *map = virBitmapNew(maxcpu);
-    if (!map) {
+    if (!*map) {
         virReportOOMError();
         return -1;
     }