From nobody Sun Apr 28 08:21:14 2024 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1582913836; cv=none; d=zohomail.com; s=zohoarc; b=kHZzzeQs9cuSGCRwhFA8SlvCCS6BOsGhJD6G74ZFLQp4vsgVduHZqcjztBIAmU5YpGhRLxNWWO+rq2SKJC/oc/KCp1cXTvDxLbQ1WzVcKT6DknUV1lWYYJ8ZU0ysYwaAMli9LwTL9jDBfOlqpQ79Zq91kf/0FLz2kKelXMtsw6U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582913836; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=wrRkNJaVmcTabIjFXE7rZaWwvXcKrt71plg5qP0e4zw=; b=h5xi1GjA/LGqtcOGti6iHuWOHML8hu8bVP+41vf7V4hrtvTgHqtc1LN0ES2ZWM9i7BRcq9k/4HakyWG953qjFtTjoX/k0rUp0HciSD5VeI4u0/Z1AbcPRtImpV3X+JaCVgy+sCMUVV2HBv1H6ULhbse87fiKqdH2ddVl/yEHAlw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1582913836310322.6514999907706; Fri, 28 Feb 2020 10:17:16 -0800 (PST) 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-462-MqM6umDwPRC8_Pg3tTzhCg-1; Fri, 28 Feb 2020 13:17:12 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DD6EE800053; Fri, 28 Feb 2020 18:17:04 +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 74A28101D495; Fri, 28 Feb 2020 18:17:04 +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 3AA888448D; Fri, 28 Feb 2020 18:17:00 +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 01SIGwhu012408 for ; Fri, 28 Feb 2020 13:16:58 -0500 Received: by smtp.corp.redhat.com (Postfix) id 748F113BBAD; Fri, 28 Feb 2020 18:16:58 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7054413BF4D for ; Fri, 28 Feb 2020 18:16:56 +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 4E12D80066D for ; Fri, 28 Feb 2020 18:16:56 +0000 (UTC) Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-396-ZXf1eZ66PdqX_AuhARqZsg-1; Fri, 28 Feb 2020 13:16:53 -0500 Received: by mail-pf1-f193.google.com with SMTP id p14so2116428pfn.4 for ; Fri, 28 Feb 2020 10:16:53 -0800 (PST) Received: from localhost.localdomain ([106.207.161.28]) by smtp.gmail.com with ESMTPSA id x21sm11585104pfn.164.2020.02.28.10.16.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2020 10:16:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582913834; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=wrRkNJaVmcTabIjFXE7rZaWwvXcKrt71plg5qP0e4zw=; b=Iko7EtVEbhBv768hO9GZJG4mtd5EHAIg4RZveAwHgEU2WQ239vVpFiEC7r1UotRlyUjQMJ DJRLOrK3NC+1DDbmHAOihtoBUqhN3PwpyjeN+AndNL2GVoSXabg7eLowj+AvGZh7ZGd0G6 BUqe7Awto9uO0XV6vkk5VAi9VRnRIvk= X-MC-Unique: MqM6umDwPRC8_Pg3tTzhCg-1 X-MC-Unique: ZXf1eZ66PdqX_AuhARqZsg-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:mime-version :content-transfer-encoding; bh=5F51xk7gPp/W0t1rtfj0b4I6bq2dI5MztsPiJb2AVFc=; b=cByxIJtPxL4OAU18ZfKwpFQovk0HLXnvMTdl/gRHP68CnxRyRlDjrP3wzdnpWmpwgY 1Iesc2us9E48aXT0/8jYLfJXWDSqFZujYn8fDyXmyzQX44F/cVplJVu2W5zFpQm7ETaZ tVUgcuAFNV1JC8RV4jlfn+1iXPcW6hoTSnPNPJH4/Bp/WKxTNN673SIuJYVDEgI7ZKyX sNLOxMfcUrYY/GsVmWDpcD1UVuiQDAXOHV3dgul0ZZpeE5E1edBxeprIkt9rPaJ5aF27 JyvHCALx9dveKUtg2utYOwSXw8NT+WecAq50k6mk6x7GzcttDsJq7Zzm21OjwfC+FWYh XHww== X-Gm-Message-State: APjAAAWjvLBFluOVN7K0CKyU2x/aOJW5K6ocqF+YyJQBCct21KtUtC67 NLObhytQruMamzXzagtgqGyroRoA X-Google-Smtp-Source: APXvYqxKXizTcIED5SyT0s7SUlX01DWE8tdGn7yLv7ZjPSEkGLMNQ5uVtF6ZMKPzzBFY1tiZ4SUNZQ== X-Received: by 2002:a62:16d0:: with SMTP id 199mr5632995pfw.96.1582913811872; Fri, 28 Feb 2020 10:16:51 -0800 (PST) From: Gaurav Agrawal To: libvir-list@redhat.com Subject: [PATCH] admin: use g_autofree Date: Fri, 28 Feb 2020 23:46:40 +0530 Message-Id: <20200228181640.135444-1-agrawalgaurav@gnome.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 01SIGwhu012408 X-loop: libvir-list@redhat.com Cc: GAURAV AGRAWAL 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.84 on 10.5.11.22 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" From: GAURAV AGRAWAL Signed-off-by: Gaurav Agrawal --- src/admin/libvirt-admin.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/admin/libvirt-admin.c b/src/admin/libvirt-admin.c index 4099a54854..17d0eb39fe 100644 --- a/src/admin/libvirt-admin.c +++ b/src/admin/libvirt-admin.c @@ -111,7 +111,7 @@ getSocketPath(virURIPtr uri) virURIParamPtr param =3D &uri->params[i]; =20 if (STREQ(param->name, "socket")) { - VIR_FREE(sock_path); + g_free(sock_path); sock_path =3D g_strdup(param->value); } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -203,11 +203,11 @@ virAdmGetDefaultURI(virConfPtr conf, char **uristr) virAdmConnectPtr virAdmConnectOpen(const char *name, unsigned int flags) { - char *sock_path =3D NULL; + g_autofree char *sock_path =3D NULL; char *alias =3D NULL; virAdmConnectPtr conn =3D NULL; g_autoptr(virConf) conf =3D NULL; - char *uristr =3D NULL; + g_autofree char *uristr =3D NULL; =20 if (virAdmInitialize() < 0) goto error; @@ -233,7 +233,7 @@ virAdmConnectOpen(const char *name, unsigned int flags) goto error; =20 if (alias) { - VIR_FREE(uristr); + g_free(uristr); uristr =3D alias; } =20 @@ -251,16 +251,11 @@ virAdmConnectOpen(const char *name, unsigned int flag= s) if (remoteAdminConnectOpen(conn, flags) < 0) goto error; =20 - cleanup: - VIR_FREE(sock_path); - VIR_FREE(uristr); return conn; =20 error: virDispatchError(NULL); - virObjectUnref(conn); - conn =3D NULL; - goto cleanup; + return NULL; } =20 /** --=20 2.24.1