From nobody Sat Feb 7 08:32:25 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633864; cv=none; d=zohomail.com; s=zohoarc; b=TiQ9vsdYbtVJBTPF1nrZrW3qKdpizzeqMgmIBt8lriX4V4IS7E0h3GeYHSVc7Fs74yQbiYgUwIw6ZKbYm5+ZMPukIv7sL5qIKoIRoCXpCj1OBW5tq2ZMShyM9U1GTWFYo0OcjdZpgn80l2OwkdM8hebH80DN8dxnv4qwh9otcDQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633864; 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; bh=JWKSoeRpjLQhUPJBc/ctKnsiQ+LQ4u7IIQeUvJhWUMQ=; b=OYglU16FB8+9DQAgtJnidyDKwBwLM+O3Y38254qzsS3hxBMeYebt/xmLr1u7Kw/pCgn0Y9rMqjDy63DQZc25WjBfMAktWL7L+ahvSbbylDR3CeLRDfzO9+F/9Tnvxo4YzDT0trznP6MF8RF8AGOkQfwLCQJ0TLPrEsYMWi+qmqs= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1594633864748794.0494537391974; Mon, 13 Jul 2020 02:51: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-310-bmZ-gR5BMpO2Ps8cE_Nsew-1; Mon, 13 Jul 2020 05:51:00 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6C8EB19200D0; Mon, 13 Jul 2020 09:50:54 +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 EE7BB27DE8E; Mon, 13 Jul 2020 09:50:51 +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 BEAE018005C5; Mon, 13 Jul 2020 09:50:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9oXbA005777 for ; Mon, 13 Jul 2020 05:50:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id A19E9217B43C; Mon, 13 Jul 2020 09:50:33 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 876E4217B436 for ; Mon, 13 Jul 2020 09:50:33 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 69C8F83B822 for ; Mon, 13 Jul 2020 09:50:33 +0000 (UTC) Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-20-asCYLYaxOGeVehP1oB-oCw-1; Mon, 13 Jul 2020 05:50:31 -0400 Received: by mail-qk1-f194.google.com with SMTP id r22so11518769qke.13 for ; Mon, 13 Jul 2020 02:50:31 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:30 -0700 (PDT) X-MC-Unique: bmZ-gR5BMpO2Ps8cE_Nsew-1 X-MC-Unique: asCYLYaxOGeVehP1oB-oCw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JWKSoeRpjLQhUPJBc/ctKnsiQ+LQ4u7IIQeUvJhWUMQ=; b=r2ptAtDdAXOA/bZ8LJFR/uqBLunFh8PtF0+A/BBKPdfRnPFy/1McHl+hFUkGE/9Sr+ lLTw9o0vuy/65y5t2pCUAOzoJru6Mlb53wlOI13do9Nzt0/RnCMRXDXP+HQtIk++kPXm A7KaeJuMhEq+JGNkGSsB9JLcTcashC51hVFUyI9SeIhCltY0k1Ypd+H10kdHS6ll6C0l w239To/4y+JpRfoFRSLbvNOxJgrIb6MKIVNl0XSjoOzOYgzmZNFCe61X1OyxXRjLJaxQ nEzl8OZ+bA2sr216e1+kPMQjS7/AD41NBmVJx1EZOu7F7f9RoqNHSaBde6dABnBPRMcR YgYw== X-Gm-Message-State: AOAM530SIq9HRonR7lS44a8NK6xG56AZ9EO4xWcvmd8L8qOc1IG/JTBp 9HxBCL9RHwnrx69CEvzkfVR3yFOx5A4= X-Google-Smtp-Source: ABdhPJyESnv/+ad1PNye0EbAcEsY+Ap/Ly+lZwF+B9R50oKpcrpRQ6nIclxn2DtG8bBg81DZKGRkLA== X-Received: by 2002:a37:45c4:: with SMTP id s187mr81225498qka.246.1594633830618; Mon, 13 Jul 2020 02:50:30 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 16/25] qemu_migration_cookie.c: modernize qemuMigrationEatCookie() Date: Mon, 13 Jul 2020 06:49:48 -0300 Message-Id: <20200713094957.1648405-17-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza 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.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use g_autoptr() and remove the obsolete 'error' label. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_migration_cookie.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_coo= kie.c index 2e48d1b524..81b557e0a8 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -1464,14 +1464,14 @@ qemuMigrationEatCookie(virQEMUDriverPtr driver, int cookieinlen, unsigned int flags) { - qemuMigrationCookiePtr mig =3D NULL; + g_autoptr(qemuMigrationCookie) mig =3D NULL; =20 /* Parse & validate incoming cookie (if any) */ if (cookiein && cookieinlen && cookiein[cookieinlen-1] !=3D '\0') { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Migration cookie was not NULL terminated")); - goto error; + return NULL; } =20 VIR_DEBUG("cookielen=3D%d cookie=3D'%s'", cookieinlen, NULLSTR(cookiei= n)); @@ -1485,7 +1485,7 @@ qemuMigrationEatCookie(virQEMUDriverPtr driver, priv ? priv->qemuCaps : NULL, cookiein, flags) < 0) - goto error; + return NULL; =20 if (flags & QEMU_MIGRATION_COOKIE_PERSISTENT && mig->persistent && @@ -1500,7 +1500,7 @@ qemuMigrationEatCookie(virQEMUDriverPtr driver, virReportError(VIR_ERR_INTERNAL_ERROR, _("Missing %s lock state for migration cook= ie"), virLockManagerPluginGetName(driver->lockMan= ager)); - goto error; + return NULL; } } else if (STRNEQ(mig->lockDriver, virLockManagerPluginGetName(driver->lockManager)= )) { @@ -1508,16 +1508,12 @@ qemuMigrationEatCookie(virQEMUDriverPtr driver, _("Source host lock driver %s different from ta= rget %s"), mig->lockDriver, virLockManagerPluginGetName(driver->lockManager= )); - goto error; + return NULL; } } =20 if (flags & QEMU_MIGRATION_COOKIE_STATS && mig->jobInfo) mig->jobInfo->operation =3D priv->job.current->operation; =20 - return mig; - - error: - qemuMigrationCookieFree(mig); - return NULL; + return g_steal_pointer(&mig); } --=20 2.26.2