From nobody Mon Apr 29 13:03:10 2024 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; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1569589639; cv=none; d=zoho.com; s=zohoarc; b=HjVSIfr52gq91q4gemQwjmF3yn31fCCctq/eRiI+PFKFa/n92OpRfsOOu+aMzZMCKy+BwuLB1426EHJ5Xgn9ZmPeMKe2YLwmx6urJR8SrNTTJODXVNcF59lKfZ2f2Atvvv5l8PPA+sMKln/5JlI3xxSzAUaS65TR2kwVrD0HKE0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569589639; h=Content-Type:Content-Transfer-Encoding:Cc: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:ARC-Authentication-Results; bh=+TkvfLzWdw4ZqhQMcmwu3v46sxZo1MMZJaEsGAGK+hU=; b=S8UMm1vSZgoSfeVwhHqpj77rwubiBQfpkGE2eXWH5Y5WTA7GE+I0z3bqryh+TXIPA6mMKPS/9c08lJfGPz2VNahhdQFHyWL2CHhv/OMR8WgsYRu2sFHcHS+K0Tf7dst9ZrP0RIgYypGMGQweBETJhQgSxaw1xFSg4V4AT1FV0gs= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1569589639235231.62961975702785; Fri, 27 Sep 2019 06:07:19 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8420A306F4A9; Fri, 27 Sep 2019 13:07:17 +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 544B25D9C9; Fri, 27 Sep 2019 13:07:17 +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 0EA26180B761; Fri, 27 Sep 2019 13:07:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8RD5MBg003386 for ; Fri, 27 Sep 2019 09:05:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id F0AC460CD0; Fri, 27 Sep 2019 13:05:22 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 51A1F60BF3; Fri, 27 Sep 2019 13:05:22 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 27 Sep 2019 15:05:13 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 1/4] util: object: Note that VIR_AUTOUNREF variables must have the reference 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: , 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Fri, 27 Sep 2019 13:07:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" When a pointer is assigned to a variable marked by VIR_AUTOUNREF it will be unref'd when the stack frame of the variable is destroyed and thus users must assign it only when they wish to shed the reference. Add this as a note to the VIR_AUTOUNREF macro. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/util/virobject.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/virobject.h b/src/util/virobject.h index fe5dbe7326..6fca4cd166 100644 --- a/src/util/virobject.h +++ b/src/util/virobject.h @@ -117,7 +117,9 @@ virObjectAutoUnref(void *objptr); * @type: type of an virObject subclass to be unref'd automatically * * Declares a variable of @type which will be automatically unref'd when - * control goes out of the scope. + * control goes out of the scope. The object referenced by the pointer ass= igned + * to the variable declared by this macro must already have the reference + * counter increased at the time of assignment. */ #define VIR_AUTOUNREF(type) \ __attribute__((cleanup(virObjectAutoUnref))) type --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 13:03:10 2024 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; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1569589646; cv=none; d=zoho.com; s=zohoarc; b=kyj1KcxnuUTBYA8B5dVmpzaVtDWFPDeKgp0pBNBh+S8Rbzfgwd9mqeN3a565dRe6n9NoS/+c3jhIhSeoE5C/wHwBSe/wX3/ztD1YOgFwwNMJSNlng/3EAR/34hbVfWPrF+Nn6jgb7dfc7IBZVpbXqijhP9u+Mq+f1mPlFl9FHzY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569589646; h=Content-Type:Content-Transfer-Encoding:Cc: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:ARC-Authentication-Results; bh=iMjUmAmPoN0u6hWNaVNJt+dhEncmqF4Z/gsQ52al8nQ=; b=BtV9PdOcMMZzpLZ1MrN+igoX2POiB4M/EZ/PBbsT4FxcpmiH0Et01+l2YAuBRjSRuPVHMdGTG6FYRPhoQDEz2hMlnM6iQQmf7rM2vGdNIilxHZmVAQgM2wBXB3ajBYItHi3xGkPnUhfURiFiVuAK1Q1vJVOnv1zpYbIm5Xj+RRs= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1569589646492344.87421397658807; Fri, 27 Sep 2019 06:07:26 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C77AF10CC210; Fri, 27 Sep 2019 13:07:24 +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 8FD7C5D6B2; Fri, 27 Sep 2019 13:07:24 +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 4D80E4EE50; Fri, 27 Sep 2019 13:07:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8RD5NT8003391 for ; Fri, 27 Sep 2019 09:05:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id E5D2C60C5D; Fri, 27 Sep 2019 13:05:23 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 476A660BF3; Fri, 27 Sep 2019 13:05:23 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 27 Sep 2019 15:05:14 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 2/4] util: object: Add VIR_AUTOUNLOCK and VIR_AUTORELEASE 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: , 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Fri, 27 Sep 2019 13:07:25 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Add helpers for using automatic stack'd variable cleaning for lockable objects. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/libvirt_private.syms | 2 ++ src/util/virobject.c | 29 +++++++++++++++++++++++++++++ src/util/virobject.h | 30 ++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 7b681fac64..5c8fd6a929 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2635,6 +2635,8 @@ virClassForObjectRWLockable; virClassIsDerivedFrom; virClassName; virClassNew; +virObjectAutoRelease; +virObjectAutoUnlock; virObjectAutoUnref; virObjectFreeCallback; virObjectFreeHashData; diff --git a/src/util/virobject.c b/src/util/virobject.c index 919519735a..6bc8b08c89 100644 --- a/src/util/virobject.c +++ b/src/util/virobject.c @@ -381,6 +381,35 @@ virObjectAutoUnref(void *objptr) } +/** + * virObjectAutoUnlock: + * + * Helper used by VIR_AUTOUNLOCK + */ +void +virObjectAutoUnlock(void *objptr) +{ + virObjectPtr *obj =3D objptr; + virObjectUnlock(*obj); + *obj =3D NULL; +} + + +/** + * virObjectAutoRelease: + * + * Helper used by VIR_AUTORELEASE + */ +void +virObjectAutoRelease(void *objptr) +{ + virObjectPtr *obj =3D objptr; + virObjectUnlock(*obj); + virObjectUnref(*obj); + *obj =3D NULL; +} + + /** * virObjectRef: * @anyobj: any instance of virObjectPtr diff --git a/src/util/virobject.h b/src/util/virobject.h index 6fca4cd166..2f3f6d207e 100644 --- a/src/util/virobject.h +++ b/src/util/virobject.h @@ -112,6 +112,12 @@ virObjectUnref(void *obj); void virObjectAutoUnref(void *objptr); +void +virObjectAutoUnlock(void *objptr); + +void +virObjectAutoRelease(void *objptr); + /** * VIR_AUTOUNREF: * @type: type of an virObject subclass to be unref'd automatically @@ -124,6 +130,30 @@ virObjectAutoUnref(void *objptr); #define VIR_AUTOUNREF(type) \ __attribute__((cleanup(virObjectAutoUnref))) type +/** + * VIR_AUTOUNLOCK: + * @type: type of an virObjectLockable subclass to be unlocked automatical= ly + * + * Declares a variable of @type which will be automatically unlocked when + * control goes out of the scope. The lockable object referenced by the po= inter + * assigned to the variable declared by this macro must already be locked + * at the time of assignment. + */ +#define VIR_AUTOUNLOCK(type) \ + __attribute__((cleanup(virObjectAutoUnlock))) type + +/** + * VIR_AUTORELEASE: + * @type: type of an virObjectLockable subclass to be unlocked and unref'd= automatically + * + * Declares a variable of @type which will be automatically unlocked and u= nref'd + * when control goes out of the scope. The lockable object referenced by t= he + * pointer assigned to the variable declared by this macro must already be + * locked and referenced at the time of assignment. + */ +#define VIR_AUTORELEASE(type) \ + __attribute__((cleanup(virObjectAutoRelease))) type + void * virObjectRef(void *obj); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 13:03:10 2024 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; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1569589644; cv=none; d=zoho.com; s=zohoarc; b=Gs2eQJDuPiUng/DUBGUT2xHYnVnWrIzhmR0h0F+0+T4kIvI8G5ZftUT1MKO4urqj6AGnL1S2zM3LdGFJ0blos8NoRTtZ4vxrqBhqAzjM6Ev33HGiZuuDYpdGzADklFkAAnKjUfIBYbtdcfxeiGdNFu+U4mx1EPOKKpKL2UC2L4U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569589644; h=Content-Type:Content-Transfer-Encoding:Cc: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:ARC-Authentication-Results; bh=diEBdwkKzDsj7gRV2u9z4v6xu6ssX7P2ZsRJ9VVocY0=; b=f3c/vGx5lnJf5zKUZ3/GoO3b8x7K51r9AGbfsEhrplg/37bkRSlUlAQLSZ3A1OpppSJFXsku2HLhl/c/kOjzv0nPrTs8eXVwEXk2CqI60+SbYOS9QtXqk0IpbZFxDF//NbBZ4f31xFocvOWmerbyDazLBjG0KQYkVWGuILkgtvQ= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1569589644570707.3563769086683; Fri, 27 Sep 2019 06:07:24 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id D07D07FDFF; Fri, 27 Sep 2019 13:07:22 +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 9EEB2194B6; Fri, 27 Sep 2019 13:07:22 +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 58F844EDA5; Fri, 27 Sep 2019 13:07:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8RD5OAE003403 for ; Fri, 27 Sep 2019 09:05:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id DC7C660C5D; Fri, 27 Sep 2019 13:05:24 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F56B60BF3; Fri, 27 Sep 2019 13:05:24 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 27 Sep 2019 15:05:15 +0200 Message-Id: <09c2889b32cf73faa5633e7bc54540ae98d24b69.1569589451.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 3/4] qemu: driver: Convert qemuDomainGetInfo to use VIR_AUTORELEASE 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: , 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.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 27 Sep 2019 13:07:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" As an example of how to use VIR_AUTORELEASE let's convert this API's 'vm' object to use the new helper. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c61295bbbb..0988071708 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2723,14 +2723,13 @@ qemuDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info) { unsigned long long maxmem; - virDomainObjPtr vm; - int ret =3D -1; + VIR_AUTORELEASE(virDomainObjPtr) vm =3D NULL; if (!(vm =3D qemuDomObjFromDomain(dom))) - goto cleanup; + return -1; if (virDomainGetInfoEnsureACL(dom->conn, vm->def) < 0) - goto cleanup; + return -1; qemuDomainUpdateCurrentMemorySize(vm); @@ -2742,33 +2741,29 @@ qemuDomainGetInfo(virDomainPtr dom, if (VIR_ASSIGN_IS_OVERFLOW(info->maxMem, maxmem)) { virReportError(VIR_ERR_OVERFLOW, "%s", _("Initial memory size too large")); - goto cleanup; + return -1; } if (VIR_ASSIGN_IS_OVERFLOW(info->memory, vm->def->mem.cur_balloon)) { virReportError(VIR_ERR_OVERFLOW, "%s", _("Current memory size too large")); - goto cleanup; + return -1; } if (virDomainObjIsActive(vm)) { if (qemuGetProcessInfo(&(info->cpuTime), NULL, NULL, vm->pid, 0) <= 0) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("cannot read cputime for domain")); - goto cleanup; + return -1; } } if (VIR_ASSIGN_IS_OVERFLOW(info->nrVirtCpu, virDomainDefGetVcpus(vm->d= ef))) { virReportError(VIR_ERR_OVERFLOW, "%s", _("cpu count too large")); - goto cleanup; + return -1; } - ret =3D 0; - - cleanup: - virDomainObjEndAPI(&vm); - return ret; + return 0; } static int --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 13:03:10 2024 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; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1569589648; cv=none; d=zoho.com; s=zohoarc; b=ZoI7MHQMVzKUJjI6uyVhWRyk9UFZ3B95o0Op+KRcIaAd6w7IqC5Ki12nBdiuVYQOdwvKuK1aOHpzU9pS49F+xwxC3EvdkjOmIrizVwZw2Pa+BG41AM2rZSKMvr0OVzHOWkT0vXtIv4IKG6xABbHHvWRu1jXsM/S+ppHJ5A8q5Ew= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569589648; h=Content-Type:Content-Transfer-Encoding:Cc: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:ARC-Authentication-Results; bh=prmOrYFxznnhmT5LfTB6SepPAqQ5nbqxAgq6j+XNPJE=; b=L0Gtis2UHv+vDxi4tAhYU/0OknLs3ox3bUeIprv29w2IvzNXPaf2I/bfutq5ORl5PimBjr2+nRQ5ae0DC2LbXzpHB0mtwguAsRUOC8Og8akTuOZmNHGvPGZ6yCgdQbWem0ydr3mN4mpzc6sTBVoXpFleR/pgHcv82ZntEFYmMUg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1569589648457999.0800991699148; Fri, 27 Sep 2019 06:07:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 63C43308FC22; Fri, 27 Sep 2019 13:07:26 +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 3AF0860625; Fri, 27 Sep 2019 13:07:26 +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 F0CEE180B761; Fri, 27 Sep 2019 13:07:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8RD5P9X003413 for ; Fri, 27 Sep 2019 09:05:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id D495D60CD0; Fri, 27 Sep 2019 13:05:25 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 36AB060BF3; Fri, 27 Sep 2019 13:05:25 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 27 Sep 2019 15:05:16 +0200 Message-Id: <295af1ef7a7c7193f789ef5e94e1796d74eedefc.1569589451.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 4/4] qemu: Don't repeat virDomainObjEndAPI in qemuDomainBlockPull 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: , 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 27 Sep 2019 13:07:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Use VIR_AUTORELEASE instead. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 0988071708..ed59e64c10 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18911,21 +18911,19 @@ static int qemuDomainBlockPull(virDomainPtr dom, const char *path, unsigned long band= width, unsigned int flags) { - virDomainObjPtr vm; + VIR_AUTORELEASE(virDomainObjPtr) vm =3D NULL; + virCheckFlags(VIR_DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES, -1); if (!(vm =3D qemuDomObjFromDomain(dom))) return -1; - if (virDomainBlockPullEnsureACL(dom->conn, vm->def) < 0) { - virDomainObjEndAPI(&vm); + if (virDomainBlockPullEnsureACL(dom->conn, vm->def) < 0) return -1; - } if (virDomainListCheckpoints(vm->checkpoints, NULL, dom, NULL, 0) > 0)= { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("cannot perform block pull while checkpoint exist= s")); - virDomainObjEndAPI(&vm); return -1; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list