From nobody Sat Feb 7 09:06:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.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 207.211.31.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=1594633871; cv=none; d=zohomail.com; s=zohoarc; b=VX3c4zZ+2WS5BiTpAJOJhJB+oVVi85Up8nRS/cYJxHPGcjQV8+yPIXoRBA7w7ZdqzrbvJM5pLzwElF5ePKIX19q4oGftRKSeprsg+sUMu/QBLulmAVmXiAxcIv+6BiAQPWjRt7lBEfjfbr5RdRQ+ItrmNH1BRgYpwRNwPSG+KfQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633871; 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=V4Wt4qrMX/QedHiSLmpjUV/tWjTYSq3+NW99lFIlL2s=; b=JUA/aXFGPGWw6d0puH7HLe51GmXELpaWiDuCm4ZGTi+T+Xlp1IfqHyhe7VIHJ05B5cy88yEDInrMtH2yvYHZV91dKnu7aupBG27iJULBhJzWWbHM62BvNGjvON/g8AgCKmQUzwUB74ja1G0A2QR3B4WI/Ooz+LeQDj6e209j83A= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.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 [207.211.31.120]) by mx.zohomail.com with SMTPS id 1594633871949757.6604813202072; Mon, 13 Jul 2020 02:51:11 -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-429-VYwSjfS4Pxe2J3wpaV6_NQ-1; Mon, 13 Jul 2020 05:51:08 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8D67C1090; Mon, 13 Jul 2020 09:51:00 +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 698D2619C4; Mon, 13 Jul 2020 09:51:00 +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 3BE35180CB39; Mon, 13 Jul 2020 09:51:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9odb9005879 for ; Mon, 13 Jul 2020 05:50:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id CFB3120A0530; Mon, 13 Jul 2020 09:50:38 +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 BECDF20A052F for ; Mon, 13 Jul 2020 09:50:38 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.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 A5FC518056A6 for ; Mon, 13 Jul 2020 09:50:38 +0000 (UTC) Received: from mail-qv1-f45.google.com (mail-qv1-f45.google.com [209.85.219.45]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-382-XSqKGZjCO9aYw7G5x9SZeg-1; Mon, 13 Jul 2020 05:50:36 -0400 Received: by mail-qv1-f45.google.com with SMTP id u8so5477626qvj.12 for ; Mon, 13 Jul 2020 02:50:36 -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.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:34 -0700 (PDT) X-MC-Unique: VYwSjfS4Pxe2J3wpaV6_NQ-1 X-MC-Unique: XSqKGZjCO9aYw7G5x9SZeg-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=V4Wt4qrMX/QedHiSLmpjUV/tWjTYSq3+NW99lFIlL2s=; b=oUfIhcxunDSkY0ZlZXNn1iN9xmrwV1WNrPePssF4mRfROkYh4SH3geJRDL6Z+uBYvS Eih1THgwyoZDKWFX6JSRCgqor1AAG0gqtMAmf0OVl4UM0igH23qvdyqnspN3e1JZwiT/ M6djUUSaWdgaspwcPSsoHHxXh4Odyr+q8N8Plk5cA81R/yvrRiHuaLYZUUniHnrZOtTJ kweCE2DqNRfwII/IcxlzmB4WX+La1Kg35qICp+Me6vxxTRiR/lpJnw2tbfBKj8Xu5utB 89/vOEbakK2VI++PUWWU06UIsJHqhEmRzBmMMMSZPN/iuFlofdrlJHg0P5OmXxst176u Qbmg== X-Gm-Message-State: AOAM533r/d2QDJgG1uB0xWD62nIJFQ1uqusDpwMurtwpqgmHjRGOcqcp w+AqMaIFLH9CxBMnUgX23HAZFIfu+zk= X-Google-Smtp-Source: ABdhPJyC49CG1MpaV7WZY6fZkQTedkizBdBP9rzQTYp8llVmY8f9SFNE2sQuEOra0FqlcO4Wwgak3w== X-Received: by 2002:ad4:4a6d:: with SMTP id cn13mr79821049qvb.165.1594633835312; Mon, 13 Jul 2020 02:50:35 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 19/25] qemu_migration.c: use auto* in qemuMigrationSrcRun() Date: Mon, 13 Jul 2020 06:49:51 -0300 Message-Id: <20200713094957.1648405-20-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.4 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.12 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 | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 884f1bc4a0..9fa08617a2 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3467,10 +3467,10 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, int ret =3D -1; unsigned int migrate_flags =3D QEMU_MONITOR_MIGRATE_BACKGROUND; qemuDomainObjPrivatePtr priv =3D vm->privateData; - qemuMigrationCookiePtr mig =3D NULL; - char *tlsAlias =3D NULL; + g_autoptr(qemuMigrationCookie) mig =3D NULL; + g_autofree char *tlsAlias =3D NULL; qemuMigrationIOThreadPtr iothread =3D NULL; - int fd =3D -1; + VIR_AUTOCLOSE fd =3D -1; unsigned long migrate_speed =3D resource ? resource : priv->migMaxBand= width; virErrorPtr orig_err =3D NULL; unsigned int cookieFlags =3D 0; @@ -3479,8 +3479,8 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, bool bwParam =3D virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_PA= RAM_BANDWIDTH); bool cancel =3D false; unsigned int waitFlags; - virDomainDefPtr persistDef =3D NULL; - char *timestamp; + g_autoptr(virDomainDef) persistDef =3D NULL; + g_autofree char *timestamp =3D NULL; int rc; =20 VIR_DEBUG("driver=3D%p, vm=3D%p, cookiein=3D%s, cookieinlen=3D%d, " @@ -3642,10 +3642,8 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, } =20 /* log start of migration */ - if ((timestamp =3D virTimeStringNow()) !=3D NULL) { + if ((timestamp =3D virTimeStringNow()) !=3D NULL) qemuDomainLogAppendMessage(driver, vm, "%s: initiating migration\n= ", timestamp); - VIR_FREE(timestamp); - } =20 rc =3D -1; switch (spec->destType) { @@ -3779,11 +3777,6 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, ret =3D 0; =20 cleanup: - VIR_FREE(tlsAlias); - VIR_FORCE_CLOSE(fd); - virDomainDefFree(persistDef); - qemuMigrationCookieFree(mig); - if (events) priv->signalIOError =3D false; =20 --=20 2.26.2