From: Ján Tomko Date: Thu, 29 Nov 2012 09:56:56 +0000 (+0100) Subject: util: fix virBitmap allocation in virProcessInfoGetAffinity X-Git-Tag: v0.10.2.2~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4e5a4d3494a34c43b7943ffda5899651198c353;p=thirdparty%2Flibvirt.git util: fix virBitmap allocation in virProcessInfoGetAffinity 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) --- diff --git a/src/util/processinfo.c b/src/util/processinfo.c index d4f8f4b672..165023aec3 100644 --- a/src/util/processinfo.c +++ b/src/util/processinfo.c @@ -139,7 +139,7 @@ realloc: } *map = virBitmapNew(maxcpu); - if (!map) { + if (!*map) { virReportOOMError(); return -1; }