From nobody Sun Feb 8 05:32:37 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=1594633849; cv=none; d=zohomail.com; s=zohoarc; b=a1czliYAN47Oe1GukEI0AGjntQ8qof/hc5M97BqRIWWO0HAMn0OkiJ9fiSqaijM3+RfiST2lroe2EcFcwF19izlaZIALPwt9JQNW7tb/6IZQeRejxCZmDlKun7JqbIGNqtO3zfr1B3LebkviGCzOmJWXuwgB19iJvFK6nvlU6hY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633849; 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=4UcCPZhBjyZyyiPsnpnRkC5YC7BSOCtZyrKp3KVYv2Y=; b=YeXm+N8u1CIxXMbxtciC2J+cR1OSB21phCYjpkfly5uCPj4+b1zxpAyDt3IQ3mOY+Ou+h1JF/LBBqwY1sbgYD+Ti906V0dsCRyKjbYU/m5JxmsSZc1me1Ee/LcgGT4xMwW530G1v2NTp0uRo3cw8uhvWfX1ZQhsWGwuKPhm2O1Y= 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 1594633849839220.84416323924358; Mon, 13 Jul 2020 02:50:49 -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-334-HolxcR6hPhG_GsKYUgqtaw-1; Mon, 13 Jul 2020 05:50:46 -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 7D625107BEF5; Mon, 13 Jul 2020 09:50:40 +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 5E58927DE90; Mon, 13 Jul 2020 09:50:40 +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 2FE0D94EFA; Mon, 13 Jul 2020 09:50:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9oLSA005704 for ; Mon, 13 Jul 2020 05:50:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6C137E2A76; Mon, 13 Jul 2020 09:50:21 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 67B70E2A79 for ; Mon, 13 Jul 2020 09:50:21 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 4FEB018056A6 for ; Mon, 13 Jul 2020 09:50:21 +0000 (UTC) Received: from mail-qv1-f65.google.com (mail-qv1-f65.google.com [209.85.219.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-498-hw64iCZkPiaJ7OsX8twFzw-1; Mon, 13 Jul 2020 05:50:19 -0400 Received: by mail-qv1-f65.google.com with SMTP id e3so5470649qvo.10 for ; Mon, 13 Jul 2020 02:50:18 -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.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:17 -0700 (PDT) X-MC-Unique: HolxcR6hPhG_GsKYUgqtaw-1 X-MC-Unique: hw64iCZkPiaJ7OsX8twFzw-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=4UcCPZhBjyZyyiPsnpnRkC5YC7BSOCtZyrKp3KVYv2Y=; b=a2cV2Zm0qODY0xITW3iOtS33EJbK7V87Z/Btv8cwq+otJU2mZA1o2KFMYkZ2O3wY9H L9EV4qAENY80F3f6KPYwkxUMAQ/eCJhvsWy65IPmd8TBoTQk7uLP+eq3dDG98SpJqp/B apXUtPDG+v+4L/HszuZP6qoF5JNOO2UnTUw+MnsQ9XL9TZe+HvlFSYaDCHupMb+vTHoY pTGZcHHdrRSlGIzceEA7FNCQ2wvAdgXdYWGRheTnfIzrcDbt+PVZHPI8r73PeJwHWuwv ABvZCYcwJRuQZWEYmR68bYVAfbUAV0ZcXtyllbvYxvoEL+Qojx7mcm1CYlyi1Iw5qqtC +WMg== X-Gm-Message-State: AOAM533SItA0ATM+yoeTXltwfjKx1VC5QIR64iJwjB3+nY2Ff+pJPHQY 93s4bTCcs+xQBRFfbL3gO2BtpRaLTlA= X-Google-Smtp-Source: ABdhPJzzrR50tvHo2hbj3U/YL+Gh6nw8ukCxBEOorVLDQS0lCbGgPE5I4MtlebU3wNZvC6+lyVQJJQ== X-Received: by 2002:a0c:a992:: with SMTP id a18mr66780457qvb.211.1594633818215; Mon, 13 Jul 2020 02:50:18 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 08/25] qemu_migration.c: use g_auto* in qemuMigrationDstPrepareAny() Date: Mon, 13 Jul 2020 06:49:40 -0300 Message-Id: <20200713094957.1648405-9-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.79 on 10.11.54.5 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" Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_migration.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index e0077d731b..83a25e7a8f 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2389,7 +2389,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, qemuDomainObjPrivatePtr priv =3D NULL; qemuMigrationCookiePtr mig =3D NULL; bool tunnel =3D !!st; - char *xmlout =3D NULL; + g_autofree char *xmlout =3D NULL; unsigned int cookieFlags; unsigned int startFlags; qemuProcessIncomingDefPtr incoming =3D NULL; @@ -2397,7 +2397,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, bool stopProcess =3D false; bool relabel =3D false; int rv; - char *tlsAlias =3D NULL; + g_autofree char *tlsAlias =3D NULL; =20 virNWFilterReadLockFilterUpdates(); =20 @@ -2447,7 +2447,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, =20 /* Let migration hook filter domain XML */ if (virHookPresent(VIR_HOOK_DRIVER_QEMU)) { - char *xml; + g_autofree char *xml =3D NULL; int hookret; =20 if (!(xml =3D qemuDomainDefFormatXML(driver, NULL, *def, @@ -2458,7 +2458,6 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, hookret =3D virHookCall(VIR_HOOK_DRIVER_QEMU, (*def)->name, VIR_HOOK_QEMU_OP_MIGRATE, VIR_HOOK_SUBOP_BEG= IN, NULL, xml, &xmlout); - VIR_FREE(xml); =20 if (hookret < 0) { goto cleanup; @@ -2467,7 +2466,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, VIR_DEBUG("Migrate hook filter returned nothing; using the" " original XML"); } else { - virDomainDefPtr newdef; + g_autoptr(virDomainDef) newdef =3D NULL; =20 VIR_DEBUG("Using hook-filtered domain XML: %s", xmlout); newdef =3D virDomainDefParseString(xmlout, driver->xmlopt,= NULL, @@ -2476,13 +2475,11 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, if (!newdef) goto cleanup; =20 - if (!qemuDomainDefCheckABIStability(driver, NULL, *def, ne= wdef)) { - virDomainDefFree(newdef); + if (!qemuDomainDefCheckABIStability(driver, NULL, *def, ne= wdef)) goto cleanup; - } =20 virDomainDefFree(*def); - *def =3D newdef; + *def =3D g_steal_pointer(&newdef); /* We should taint the domain here. However, @vm and there= fore * privateData too are still NULL, so just notice the fact= and * taint it later. */ @@ -2694,9 +2691,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, =20 cleanup: virErrorPreserveLast(&origErr); - VIR_FREE(tlsAlias); qemuProcessIncomingDefFree(incoming); - VIR_FREE(xmlout); VIR_FORCE_CLOSE(dataFD[0]); VIR_FORCE_CLOSE(dataFD[1]); if (ret < 0 && priv) { --=20 2.26.2