From nobody Fri Dec 19 22:01:54 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1594633832; cv=none; d=zohomail.com; s=zohoarc; b=g0+GiPqWvI6Zki3WQQYcUebuiu3DJYHzoJV/In4EE4B5bVSxbMy4poQPxkUWdSFtaqxw/W/m/SMpsrYzOv89JRrF07OKCUnNQjwDBUWJIEnylokL4Z9XN8pzdxny89pK17qR2i8yHyjfrFFrHvuJdy10bujYz3XEJu/tSoMziQA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633832; 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=te+r/29lDJeDYL55G1FzJn3W59GZss5QOSXu4AboRcc=; b=E2rRywdoLBD4V9XKyjFJKoWgxOs14+ZsqcgvQxKmS3cYd/7ELIW2m791UqF5e63VxH02HQlhzdoXnxIfFcncAI72H2GPH6f/B+DTp3mq1HSDOJtsxjigtN0GCgbBrCvITOo9cHa4SPLuGUjXlHCB7Hv4wMlo3qYv4asuzfdUf84= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1594633832645883.0953963944471; Mon, 13 Jul 2020 02:50:32 -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-148-FaBPyipkOjSyxrXOLg3ZtA-1; Mon, 13 Jul 2020 05:50:27 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 800408014D4; Mon, 13 Jul 2020 09:50: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 5E8F276219; Mon, 13 Jul 2020 09:50: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 2B8DA94EF4; Mon, 13 Jul 2020 09:50:22 +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 06D9oEia005636 for ; Mon, 13 Jul 2020 05:50:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id AFA35E2A76; Mon, 13 Jul 2020 09:50:14 +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 AB379E2A92 for ; Mon, 13 Jul 2020 09:50:14 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.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 91E26924902 for ; Mon, 13 Jul 2020 09:50:14 +0000 (UTC) Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-379-bbV2pjX9PXe-sSQ9SUlnyg-1; Mon, 13 Jul 2020 05:50:11 -0400 Received: by mail-qt1-f195.google.com with SMTP id g13so9420824qtv.8 for ; Mon, 13 Jul 2020 02:50:11 -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.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:10 -0700 (PDT) X-MC-Unique: FaBPyipkOjSyxrXOLg3ZtA-1 X-MC-Unique: bbV2pjX9PXe-sSQ9SUlnyg-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=te+r/29lDJeDYL55G1FzJn3W59GZss5QOSXu4AboRcc=; b=kzUIaaUXjWmlzV3kXXfyN/abEOWMvKsetPuptoFYKrNuZVGLvbrJ492YI79rcfsKy7 WNqDIxZKeelw7Jahllm+Seb+CjFZDmaLe+j/sA0iyNB6OFJenqpfllEZPtS7vKeiSFHV 3Mtmi8OIkdPtu22K1NutVJzhZHAGi7WIG3+bIhErJluo8Y+OLFpnZQiEHtR+RJF6O4uM 0y9wp5RLVv3/6OZtwnSbbqluHYsno5ECwdud5AT/I98pRGt40LJBZyrgLTeOTYJyhaZ7 fY1xepteBG6oahcHjx993zhljZvGV9itKvrr4pHAlj55iu+ldKSXsWT0Pd0aQ7/JSydS QQMw== X-Gm-Message-State: AOAM530KrAPMPkHVNro0vKIEDobsJfHg7NsE/M2BdJ0FzV0QJwV3UFLF y4YIN3Ne1IbZDjE3FuIeN7UGkKn4C7g= X-Google-Smtp-Source: ABdhPJzbADEETaNJriVkqanM+muFlpHucqgZeCUJfm3ijOgiCW7jqD6IACGDcPBxmE4UFAVqEZbhQQ== X-Received: by 2002:ac8:2fcd:: with SMTP id m13mr54474953qta.237.1594633810551; Mon, 13 Jul 2020 02:50:10 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 03/25] libvirt-domain.c: use g_autofree in virDomainMigrateVersion* functions Date: Mon, 13 Jul 2020 06:49:35 -0300 Message-Id: <20200713094957.1648405-4-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.13 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/libvirt-domain.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 6adb58a9ef..e379623ce4 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -2816,9 +2816,9 @@ virDomainMigrateVersion2(virDomainPtr domain, unsigned long bandwidth) { virDomainPtr ddomain =3D NULL; - char *uri_out =3D NULL; - char *cookie =3D NULL; - char *dom_xml =3D NULL; + g_autofree char *uri_out =3D NULL; + g_autofree char *cookie =3D NULL; + g_autofree char *dom_xml =3D NULL; int cookielen =3D 0, ret; virDomainInfo info; virErrorPtr orig_err =3D NULL; @@ -2873,7 +2873,6 @@ virDomainMigrateVersion2(virDomainPtr domain, ret =3D dconn->driver->domainMigratePrepare2 (dconn, &cookie, &cookielen, uri, &uri_out, destflags, dname, bandwidth, dom_xml); - VIR_FREE(dom_xml); if (ret =3D=3D -1) goto done; =20 @@ -2918,8 +2917,6 @@ virDomainMigrateVersion2(virDomainPtr domain, =20 done: virErrorRestore(&orig_err); - VIR_FREE(uri_out); - VIR_FREE(cookie); return ddomain; } =20 @@ -2965,10 +2962,10 @@ virDomainMigrateVersion3Full(virDomainPtr domain, unsigned int flags) { virDomainPtr ddomain =3D NULL; - char *uri_out =3D NULL; - char *cookiein =3D NULL; - char *cookieout =3D NULL; - char *dom_xml =3D NULL; + g_autofree char *uri_out =3D NULL; + g_autofree char *cookiein =3D NULL; + g_autofree char *cookieout =3D NULL; + g_autofree char *dom_xml =3D NULL; int cookieinlen =3D 0; int cookieoutlen =3D 0; int ret; @@ -3242,10 +3239,6 @@ virDomainMigrateVersion3Full(virDomainPtr domain, =20 done: virErrorRestore(&orig_err); - VIR_FREE(dom_xml); - VIR_FREE(uri_out); - VIR_FREE(cookiein); - VIR_FREE(cookieout); virTypedParamsFree(params, nparams); return ddomain; } --=20 2.26.2