From nobody Mon Apr 29 17:55:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1616193004; cv=none; d=zohomail.com; s=zohoarc; b=ZdORz6RN9eUemfq8JagzN2Mxup08Zuf4EiaJygOChHfeQPMg/0U6PyzXfVlFn6JpwiFuais32ZMiQ/GRuNp8QYr+RwYpcwi1jsTQAznJ/AhWIkNFeCit6cDU70+S43J7jgpOaGCi1x41L8c32TjAg+HdPKW9ZnvIdrMIIeMR16w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616193004; 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=4FSc4rKbczrT1QCrw7N0gZMrtALqUvOC/Re16182Bbg=; b=JMe9s1+xeGT53Fkap05z2/O16cu2TqJ+F40RBeJqwGVbhypXJyhbx8Ne4IMmeTUQq/T+RrN1r4Ippdmje4q56sR1Q4W+FuytePusvUxmHgQiXnW6Wsiilj9/pNTtfszjjb4ALPWEp9zFs2KAaOFEOozu9mn5iyJRH4jDYweCvM8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1616193004516533.5018374849911; Fri, 19 Mar 2021 15:30:04 -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-40-mWkGJHf5PuKyTwyLJwcA7g-1; Fri, 19 Mar 2021 18:29:02 -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 BC24480D6AB; Fri, 19 Mar 2021 22:28:56 +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 9A1E119CB1; Fri, 19 Mar 2021 22:28:56 +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 589C2180B450; Fri, 19 Mar 2021 22:28:56 +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 12JMSiCR021359 for ; Fri, 19 Mar 2021 18:28:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 74F3D19CB1; Fri, 19 Mar 2021 22:28:44 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.40.194.173]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 48B1219CBC for ; Fri, 19 Mar 2021 22:28:40 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 7508324015B; Fri, 19 Mar 2021 23:28:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616193003; 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=4FSc4rKbczrT1QCrw7N0gZMrtALqUvOC/Re16182Bbg=; b=TBoqIVDKh7WuYjvbA/xVg/V2pf1JDbSik/YnA4EwjrkuxQUnyBIrY9YanQcMavxkypHYud I0Puoc9RwiIAGKfh1PIDlw8EmB5h9n0f5COiTNbERuw/eLya4F5NQACjXWZdEToLRENlJC KoArfoXK4UkWKj6/DJuqrudDQGDzdN0= X-MC-Unique: mWkGJHf5PuKyTwyLJwcA7g-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 1/2] qemu: Use g_autofree in qemuMigrationJobCheckStatus Date: Fri, 19 Mar 2021 23:28:37 +0100 Message-Id: <429534d1cbe4b0f3a8053dcd4011453ecdf4f3c4.1616192206.git.jdenemar@redhat.com> 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: Erik Skultety --- src/qemu/qemu_migration.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 79dcb4a15d..ba2ee4f081 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1703,9 +1703,8 @@ qemuMigrationJobCheckStatus(virQEMUDriverPtr driver, { qemuDomainObjPrivatePtr priv =3D vm->privateData; qemuDomainJobInfoPtr jobInfo =3D priv->job.current; - char *error =3D NULL; + g_autofree char *error =3D NULL; bool events =3D virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVE= NT); - int ret =3D -1; =20 if (!events || jobInfo->stats.mig.status =3D=3D QEMU_MONITOR_MIGRATION_STATUS_ERR= OR) { @@ -1719,18 +1718,18 @@ qemuMigrationJobCheckStatus(virQEMUDriverPtr driver, case QEMU_DOMAIN_JOB_STATUS_NONE: virReportError(VIR_ERR_OPERATION_FAILED, _("%s: %s"), qemuMigrationJobName(vm), _("is not active")); - goto cleanup; + return -1; =20 case QEMU_DOMAIN_JOB_STATUS_FAILED: virReportError(VIR_ERR_OPERATION_FAILED, _("%s: %s"), qemuMigrationJobName(vm), error ? error : _("unexpectedly failed")); - goto cleanup; + return -1; =20 case QEMU_DOMAIN_JOB_STATUS_CANCELED: virReportError(VIR_ERR_OPERATION_ABORTED, _("%s: %s"), qemuMigrationJobName(vm), _("canceled by client")); - goto cleanup; + return -1; =20 case QEMU_DOMAIN_JOB_STATUS_COMPLETED: case QEMU_DOMAIN_JOB_STATUS_ACTIVE: @@ -1741,11 +1740,7 @@ qemuMigrationJobCheckStatus(virQEMUDriverPtr driver, break; } =20 - ret =3D 0; - - cleanup: - VIR_FREE(error); - return ret; + return 0; } =20 =20 --=20 2.31.0 From nobody Mon Apr 29 17:55:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1616192936; cv=none; d=zohomail.com; s=zohoarc; b=PJ3uJ9hBBlirKIviVpy18rtXE3iDxx0p5UMbLHEfPkMCm/bpeXVM9j2IMgREGGj8PRm2wVSjLxtXLV36lsHESFtR97AjNROn4zaqfTIg6cEbQrsTAjSN8O9z2gWSL6PlNrfkp7kKrhyKZP8fvBqktnWI0gM/3DUHatmjgMah/Sg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616192936; 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=84aDC8XgA5xFySfIg6N+C5BAH7/DXbi26oYi/I+j65Q=; b=T6WtZrDmr07NXiJOJYMfnZY8AZosM0FDrMuAMDJA5fGtR+UK68/dF/BXmhv5hU5PDOckoKQDD4IO2EnPLjNzpudfoptY3TMbNEnX2z+W3akl2i42ol++CWRd83sX46Tspi3KAp97p5rr3UCyaJPy9EZZVe5iM+dw6aGbKPoePK8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1616192936423499.528330216069; Fri, 19 Mar 2021 15:28:56 -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-378-NQooXSMjPcCP3timf7XXHg-1; Fri, 19 Mar 2021 18:28:53 -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 2389C107ACCD; Fri, 19 Mar 2021 22:28:48 +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 C8E7C19CBC; Fri, 19 Mar 2021 22:28:47 +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 93AA21809C81; Fri, 19 Mar 2021 22:28:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12JMSiGm021349 for ; Fri, 19 Mar 2021 18:28:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3E2AC19D9D; Fri, 19 Mar 2021 22:28:44 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.40.194.173]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 047461F05D for ; Fri, 19 Mar 2021 22:28:40 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 7722F244031; Fri, 19 Mar 2021 23:28:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616192935; 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=84aDC8XgA5xFySfIg6N+C5BAH7/DXbi26oYi/I+j65Q=; b=OJRHCDQdGbjQGu29sH+6M6XrDLR4JrQA533LbY5L3nCtTnBA4UCrnoptTELj5qQqhn/myL uJjln8B9A+UDRbmjjEtZ2/Z+/dQR5qT+lD8zFON1ZKA9NXHBv8EnokHQ3StfL/SDM5Ynt3 U55+4uv2/d4yLP9IENu7M8ElWw3MWwo= X-MC-Unique: NQooXSMjPcCP3timf7XXHg-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 2/2] qemu: Use g_autoptr in qemuMonitorJSONSetCapabilities Date: Fri, 19 Mar 2021 23:28:38 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: Erik Skultety --- src/qemu/qemu_monitor_json.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index b669630bc8..5e7f425495 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -1644,23 +1644,20 @@ qemuMonitorJSONHumanCommand(qemuMonitorPtr mon, int qemuMonitorJSONSetCapabilities(qemuMonitorPtr mon) { - int ret =3D -1; - virJSONValuePtr cmd =3D qemuMonitorJSONMakeCommand("qmp_capabilities",= NULL); - virJSONValuePtr reply =3D NULL; - if (!cmd) + g_autoptr(virJSONValue) cmd =3D NULL; + g_autoptr(virJSONValue) reply =3D NULL; + + if (!(cmd =3D qemuMonitorJSONMakeCommand("qmp_capabilities", + NULL))) return -1; =20 if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) - goto cleanup; + return -1; =20 if (qemuMonitorJSONCheckError(cmd, reply) < 0) - goto cleanup; + return -1; =20 - ret =3D 0; - cleanup: - virJSONValueFree(cmd); - virJSONValueFree(reply); - return ret; + return 0; } =20 =20 --=20 2.31.0