From nobody Sun Feb 8 17:21:17 2026 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1532174953866633.3873089573002; Sat, 21 Jul 2018 05:09:13 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8E3AE356FC; Sat, 21 Jul 2018 12:09:12 +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 54F79308BDAD; Sat, 21 Jul 2018 12:09:12 +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 094DA1841C57; Sat, 21 Jul 2018 12:09:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6LC8fO1016534 for ; Sat, 21 Jul 2018 08:08:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 54913C4A64; Sat, 21 Jul 2018 12:08:41 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4C035CC106 for ; Sat, 21 Jul 2018 12:08:37 +0000 (UTC) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C7E1F87628 for ; Sat, 21 Jul 2018 12:08:26 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id p23-v6so8961808pgv.13 for ; Sat, 21 Jul 2018 05:08:26 -0700 (PDT) Received: from centos.localdomain ([42.106.1.69]) by smtp.gmail.com with ESMTPSA id s16-v6sm5861694pfm.114.2018.07.21.05.08.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Jul 2018 05:08:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=m8/2IYuVFOBpfouYegF7ooIJ2cEy+2rDeoKW1D0X3zQ=; b=sWIl/8zL5q9sKlyGZ0u1Fz7Q/e0ExALpceEMd+tED/z0A6J+kb/t/1kWsXMybuGnFx 7wVMua+ULlObTLL19vaKOqHMcmcNWdtVbBNvhOgito7Q8z1ns7mgA+CBwPC25G1Vqdjv I1YWz4hpmHv73AJy+PnnRd0s6G6vjY591sR08ZAJ+EJ7iaxDaw1rfyovgasFtd7XA6aX G6EthQ+XCi+Hl89S6uatM1lKZs473Kxfs3rRMB6htIEQtJXIXLkzbwB/hxNOT7isX8e3 JfGVuQfacUwQwAdaFur1G/SzJFZD7VFIhuLCIAC46PuQ9qLksvg4zCcl6gLCjYubbddm 5wjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=m8/2IYuVFOBpfouYegF7ooIJ2cEy+2rDeoKW1D0X3zQ=; b=AOI1OWGkDhQtWDoJqEhL+enaGXe7hAG1IK/Fxtwb4LOYMOP71dXHjWPndS+qvH+wae VFAYWjPpNE7frnbalpaltM55OJNbPDX94Gi8hLEY7IrOWONNDTqMXRW/tlkxrAi2Sidq z5IQegXortHQcxjHK5fnc1gRxVLCi533a35b3hAHJSg6eMqQisT8mLcOWgsJz43yuVP1 CWHvmc+98dld/JS88dMgplZ+Uh2R/wpoKXj5K5/kLyFIl61xRswwfNIDWq7S4BYs5SNM 5YSShuyAq7l/L5r9a9Svz3Yz1v/XWKJySGsbmFA0X46xxIhR2EkllKU+d9w9sTzIQxJR +7bw== X-Gm-Message-State: AOUpUlE8bE7NN2SPxP8Hi/YyVJO5hfCzr9UZwcs7XP24laZ7Kh9jRlMc MmhNEUsOWqXeix2i8kR3IaF1Tfvz X-Google-Smtp-Source: AAOMgpeAmqv81NJ20drrD05p0BFRGZdKe/JuWGrQ631EmgwJYpV4C5B53qbvoaX1Ric4tHmIAnuLUg== X-Received: by 2002:a63:4506:: with SMTP id s6-v6mr5609483pga.422.1532174906127; Sat, 21 Jul 2018 05:08:26 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Sat, 21 Jul 2018 17:36:57 +0530 Message-Id: <1532174832-21644-26-git-send-email-skrtbhtngr@gmail.com> In-Reply-To: <1532174832-21644-1-git-send-email-skrtbhtngr@gmail.com> References: <1532174832-21644-1-git-send-email-skrtbhtngr@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sat, 21 Jul 2018 12:08:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sat, 21 Jul 2018 12:08:26 +0000 (UTC) for IP:'209.85.215.196' DOMAIN:'mail-pg1-f196.google.com' HELO:'mail-pg1-f196.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.281 * (DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS, T_DKIM_INVALID) 209.85.215.196 mail-pg1-f196.google.com 209.85.215.196 mail-pg1-f196.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v1 25/40] util: usb: use VIR_AUTOPTR for aggregate types 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.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Sat, 21 Jul 2018 12:09:13 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" By making use of GNU C's cleanup attribute handled by the VIR_AUTOPTR macro for declaring aggregate pointer variables, majority of the calls to *Free functions can be dropped, which in turn leads to getting rid of most of our cleanup sections. Signed-off-by: Sukrit Bhatnagar Reviewed-by: Erik Skultety --- src/util/virusb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/util/virusb.c b/src/util/virusb.c index c14683f..cfeac51 100644 --- a/src/util/virusb.c +++ b/src/util/virusb.c @@ -508,8 +508,7 @@ void virUSBDeviceListDel(virUSBDeviceListPtr list, virUSBDevicePtr dev) { - virUSBDevicePtr ret =3D virUSBDeviceListSteal(list, dev); - virUSBDeviceFree(ret); + VIR_AUTOPTR(virUSBDevice) ret =3D virUSBDeviceListSteal(list, dev); } =20 virUSBDevicePtr --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list