From nobody Sun May 5 11:08:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1596475154; cv=none; d=zohomail.com; s=zohoarc; b=kETHminXNSNUpij3qDSy6Wl4OsvgCQ5fwvv9jQclfRplWUfArIhWlDs1CuVmY52ukd9vY9tjq4OfvFrn1AleoHVHn7jrMxouXa4+SIO218FdhOCSzRoJIu7gfgUtTqkNhExkdIlaL+59C0B1PEyp76YdtDMMuCXnkflm6ygy34s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596475154; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mw0K0rRbvz5SXJ5ebk6vp5nb1j+iLhqKO/vVe3ObqRI=; b=dY9HU+rRv89G+eTfeVabZgBb/oW+7xVUYe4L+q8Htx6XPq9bHRSfY2hUguLIGSgIPikaGaoSjt4BNKohVFvRGs3kDqBGOSrT9ANlU/JC5FLROGAVvfWfWsmaI1cUdDWK0/MEdfAw0pIOiFHEcRx7zACJbNn3rbLSTf+sj1vnVoA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1596475154793716.1086613050853; Mon, 3 Aug 2020 10:19:14 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-410-UURv4UtwOji-1Ga2fVi2jA-1; Mon, 03 Aug 2020 13:19:10 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1ACA38064DD; Mon, 3 Aug 2020 17:19:05 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EEE8A87E3A; Mon, 3 Aug 2020 17:19:04 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BEEE89A109; Mon, 3 Aug 2020 17:19:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 073HJ0hk011035 for ; Mon, 3 Aug 2020 13:19:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id B652487E2C; Mon, 3 Aug 2020 17:19:00 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1BA4F7852C for ; Mon, 3 Aug 2020 17:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596475153; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=mw0K0rRbvz5SXJ5ebk6vp5nb1j+iLhqKO/vVe3ObqRI=; b=HIMY5CeGYTIAvf8sk7qOJ621whYfnp+VE1fRqk1b89DqnF4XMyePFGnqmuI8xgwkOsY2A6 N4Enxxdl9TguQ7N4TK8RYlCyFIA+1XxHjyQwTOWycK29W+OB7I8nNswE6JO5MHUs37lOiB In1B2nqKKDsz+QSt9OTdO8PITJumFPo= X-MC-Unique: UURv4UtwOji-1Ga2fVi2jA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/3] bhyve: fix NULL pointer check position Date: Mon, 3 Aug 2020 19:18:51 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) src/bhyve/bhyve_parse_command.c:437:9: warning: Either the condition '!config' is redundant or there is possible null pointer dereference: config. [nullPointerRedundantCheck] src/bhyve/bhyve_parse_command.c:280:23: warning: Either the condition '!separator' is redundant or there is pointer arithmetic with NULL pointer. [nullPointerArithmeticRedundantCheck] Signed-off-by: J=C3=A1n Tomko Reviewed-by: Roman Bogorodskiy --- src/bhyve/bhyve_parse_command.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bhyve/bhyve_parse_command.c b/src/bhyve/bhyve_parse_comman= d.c index b2d2280872..5e9cf7ba13 100644 --- a/src/bhyve/bhyve_parse_command.c +++ b/src/bhyve/bhyve_parse_command.c @@ -277,11 +277,11 @@ bhyveParseBhyveLPCArg(virDomainDefPtr def, char *type =3D NULL; =20 separator =3D strchr(arg, ','); + + if (!separator) + goto error; + param =3D separator + 1; - - if (!separator) - goto error; - type =3D g_strndup(arg, separator - arg); =20 /* Only support com%d */ @@ -434,14 +434,14 @@ bhyveParsePCIDisk(virDomainDefPtr def, disk->info.addr.pci.slot =3D pcislot; disk->info.addr.pci.function =3D function; =20 + if (!config) + goto error; + if (STRPREFIX(config, "/dev/")) disk->src->type =3D VIR_STORAGE_TYPE_BLOCK; else disk->src->type =3D VIR_STORAGE_TYPE_FILE; =20 - if (!config) - goto error; - separator =3D strchr(config, ','); if (separator) disk->src->path =3D g_strndup(config, separator - config); --=20 2.26.2 From nobody Sun May 5 11:08:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1596475156; cv=none; d=zohomail.com; s=zohoarc; b=iY2w1CEtH0ZHORiwxzRTAVEusZ7C78UhK+jxK+THtsD8XDS5Zcz+IDXJv0LWC4Z3JOzHqdwCnLvTdVqaD2JwmNKWfBHiHHmtr9S59BX8ZPmP8HJ1cIcbX8bzMxeCbGYzxcTc9if4UHM3jaCfQP/++MaXKtd1UvdxKzXA/UYgODI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596475156; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3g1phVoeFXb0AtZ48umw6fPbWrSysEQVVeUdTMV7uJw=; b=NdXo3VdkfyqnibbR33f3is7gjGSJ9A5zQbihltqpEz+iqtV7IcqskvT5ilM7gjub0ScZyQl5/P/uGbUnTBXebcYeP5BUyNG9/w16o3ozgKr2N8MKLNlPU2ActiuQnopTBmhD3ZNjdwv4/u7NLja4SGPAUzZYypTiVUEExrubdOg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1596475156891678.6016265893893; Mon, 3 Aug 2020 10:19:16 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-63-nDkDFeapOKy4N-X7vl7_rA-1; Mon, 03 Aug 2020 13:19:11 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 52DCB800469; Mon, 3 Aug 2020 17:19:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2AF3B272A5; Mon, 3 Aug 2020 17:19:04 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EBA8E1809563; Mon, 3 Aug 2020 17:19:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 073HJ31S011048 for ; Mon, 3 Aug 2020 13:19:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4A70E7852C; Mon, 3 Aug 2020 17:19:03 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C40087E3C for ; Mon, 3 Aug 2020 17:19:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596475155; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=3g1phVoeFXb0AtZ48umw6fPbWrSysEQVVeUdTMV7uJw=; b=BoljT2clOuHfS8BwumBDBLS5EAPhLG2R74oVTCQf0V9FLrVpN6Vm4i3QVufQ/NgiZG37/v fOaFObl4KjHRX81sAeVI08rdU/+HfqIf8LjkKIkiEcGt/PRbsfY+6zFiHMDxY6J1wAfrjX VvCTRuBkJMoRqGAFWb9qyON4cjf3eV8= X-MC-Unique: nDkDFeapOKy4N-X7vl7_rA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/3] virbitmap: remove redundant mem_alloc Date: Mon, 3 Aug 2020 19:18:52 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) We have two variables tracking the size of the map: map_len and mem_alloc. Remove mem_alloc as well as code keeping them in sync. Signed-off-by: J=C3=A1n Tomko Fixes: 917426c8d7dd26f13142fc4c5c1a8a19137ac647 --- src/util/virbitmap.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c index 60fd8491dd..4c205016ff 100644 --- a/src/util/virbitmap.c +++ b/src/util/virbitmap.c @@ -34,7 +34,6 @@ struct _virBitmap { size_t nbits; size_t map_len; - size_t map_alloc; =20 /* Note that code below depends on the fact that unused bits of the bi= tmap * are not set. Any function decreasing the size of the map needs clear @@ -79,7 +78,6 @@ virBitmapNewQuiet(size_t size) =20 bitmap->nbits =3D size; bitmap->map_len =3D sz; - bitmap->map_alloc =3D sz; return bitmap; } =20 @@ -197,13 +195,12 @@ virBitmapExpand(virBitmapPtr map, =20 /* resize the memory if necessary */ if (map->map_len < new_len) { - if (VIR_RESIZE_N(map->map, map->map_alloc, map->map_len, + if (VIR_RESIZE_N(map->map, map->map_len, map->map_len, new_len - map->map_len) < 0) return -1; } =20 map->nbits =3D b + 1; - map->map_len =3D new_len; =20 return 0; } @@ -1317,13 +1314,10 @@ virBitmapShrink(virBitmapPtr map, nb =3D map->nbits % VIR_BITMAP_BITS_PER_UNIT; map->map[nl] &=3D ((1UL << nb) - 1); =20 - toremove =3D map->map_alloc - (nl + 1); + toremove =3D map->map_len - (nl + 1); =20 if (toremove =3D=3D 0) return; =20 - VIR_SHRINK_N(map->map, map->map_alloc, toremove); - - /* length needs to be fixed as well */ - map->map_len =3D map->map_alloc; + VIR_SHRINK_N(map->map, map->map_len, toremove); } --=20 2.26.2 From nobody Sun May 5 11:08:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1596475156; cv=none; d=zohomail.com; s=zohoarc; b=iYb8X6AuRxNoUvUObYk3lfC0cqwRZ8L81qtTcHRUfT7NKx5D074t7F6ccqRBw5U4Ny3BadQi1m7upBW95Hd19gQMFO0NrpGAYc6mZIBHcDXJLsElGZ8XeCgNUfwjGD4ifTWu4KO3g73EsKzO7ZdSppZ12DojNK84owtp44HQu0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596475156; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=y0R6OBkn91ziA7RMT8tI3pcjgzusL17luMdWeU4Ifg8=; b=NsmJbJ1ONrUBeqQvqipBUPCDTIQ1C3zMJ8fdSqBLynSd1u27qcpGGc5uddEuJRe16j2Y4E0mc/xGMist665QMde5L8LA7XUZcERzZcW55UBHDFYzUKtsqn49iK2sKmCI7BQAe8i1xUwT1hOcZBoSRUgvlpaznqdcN31NRqEVOkE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1596475156525978.0049899663159; Mon, 3 Aug 2020 10:19:16 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-47-5cxW7u9pOsKoGX6k5H2gBA-1; Mon, 03 Aug 2020 13:19:12 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EB386E93D; Mon, 3 Aug 2020 17:19:06 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CAF037852C; Mon, 3 Aug 2020 17:19:06 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9881C1800FDE; Mon, 3 Aug 2020 17:19:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 073HJ4ax011057 for ; Mon, 3 Aug 2020 13:19:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id 69C987852C; Mon, 3 Aug 2020 17:19:04 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id B95B087E3C for ; Mon, 3 Aug 2020 17:19:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596475155; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=y0R6OBkn91ziA7RMT8tI3pcjgzusL17luMdWeU4Ifg8=; b=aiw+GrepkiXZr07sF+S6e/jxfZMxgG9hiekS48kTYvEDkrjfzJWqGUvRt1o2J9U3RmYBSF mTKSPv6Cn6cSi5+TlXsrkCZN11UNfGO8LSbvRo5MaCXhQhSw3LEpHxjkbjnsdZRODN88FA uJOKGSbkUid9BxVGt8dMjS9FW7ieexo= X-MC-Unique: 5cxW7u9pOsKoGX6k5H2gBA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 3/3] util: bitmap: use g_new0/g_free Date: Mon, 3 Aug 2020 19:18:53 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: J=C3=A1n Tomko --- src/util/virbitmap.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c index 4c205016ff..f7dd5d05ad 100644 --- a/src/util/virbitmap.c +++ b/src/util/virbitmap.c @@ -68,13 +68,8 @@ virBitmapNewQuiet(size_t size) =20 sz =3D VIR_DIV_UP(size, VIR_BITMAP_BITS_PER_UNIT); =20 - if (VIR_ALLOC_QUIET(bitmap) < 0) - return NULL; - - if (VIR_ALLOC_N_QUIET(bitmap->map, sz) < 0) { - VIR_FREE(bitmap); - return NULL; - } + bitmap =3D g_new0(virBitmap, 1); + bitmap->map =3D g_new0(unsigned long, sz); =20 bitmap->nbits =3D size; bitmap->map_len =3D sz; @@ -126,10 +121,9 @@ virBitmapNewEmpty(void) void virBitmapFree(virBitmapPtr bitmap) { - if (bitmap) { - VIR_FREE(bitmap->map); - VIR_FREE(bitmap); - } + if (bitmap) + g_free(bitmap->map); + g_free(bitmap); } =20 =20 @@ -779,9 +773,7 @@ virBitmapToData(virBitmapPtr bitmap, else len =3D (len + CHAR_BIT) / CHAR_BIT; =20 - if (VIR_ALLOC_N(*data, len) < 0) - return -1; - + *data =3D g_new0(unsigned char, len); *dataLen =3D len; =20 virBitmapToDataBuf(bitmap, *data, *dataLen); --=20 2.26.2