From nobody Thu Sep 18 03:42:55 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1512638656651893.7198746242364; Thu, 7 Dec 2017 01:24:16 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2E589C047B8E; Thu, 7 Dec 2017 09:24:15 +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 0BCBD5C3FD; Thu, 7 Dec 2017 09:24:15 +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 CA12B1800BDF; Thu, 7 Dec 2017 09:24:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vB79NCaJ007292 for ; Thu, 7 Dec 2017 04:23:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7F992183A2; Thu, 7 Dec 2017 09:23:12 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA2276940E; Thu, 7 Dec 2017 09:23:11 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Thu, 7 Dec 2017 10:22:59 +0100 Message-Id: <15b8bba27cface29b2abca400b9e59666b452407.1512638349.git.mprivozn@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: drewwynne@gmail.com, dzamirski@datto.com Subject: [libvirt] [libvirt-php][PATCH 4/7] util: Introduce VIR_FREE 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 07 Dec 2017 09:24:15 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Just like libvirt has it. After freeing pointer set it to NULL to avoid double frees. Signed-off-by: Michal Privoznik --- src/util.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/util.h b/src/util.h index fcd4075..3af77d4 100644 --- a/src/util.h +++ b/src/util.h @@ -36,6 +36,12 @@ # define DPRINTF(fmt, ...) \ debugPrint(debugSource, fmt, __VA_ARGS__) =20 +# define VIR_FREE(ptr) \ + do { \ + free(ptr); \ + ptr =3D NULL; \ + } while (0) + # define ARRAY_CARDINALITY(array) (sizeof(array) / sizeof(array[0])) =20 # define IS_BIGENDIAN (*(uint16_t *)"\0\xff" < 0x100) --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list