From nobody Mon May 6 00:16:35 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=1583345204; cv=none; d=zohomail.com; s=zohoarc; b=Gw93SvPL6eI7XMWFyET9SIntdDDGEzf2Js5xodNOBUACknpQBiMZuaBBC1ZovNItboOmQrx50IM2oqgS0lxxccctQmNJ8rP6OBy9ON1ClrSut34QxTf63bssTdZHXdHQl8vgexC3FYY7uEyRqBJYcIYmSQ7+Bc6JNUcZvxnVudM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583345204; 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=6+iPYs+mS98P+zSQ/MdiSrT3zJtSzTRzFi3nUypxp78=; b=ZYbHgawN0dapX/G4QZW4YRX5Zz2Nge5XnnjTU7/M6kXYqsevQPWDUtZu0stqhEbdfR5XWNS2mTpR0LcTToQegHcY4rx5H1Bb55TgYJ/aFJoA3UJCiyY5iFtALjqV2q2fX726MrBaA89ECWhkI5UUhHpvv+5WEZlvFceXc34Ncf4= 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-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 158334520454989.0044403144368; Wed, 4 Mar 2020 10:06:44 -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-190-VdyZCtLBNZqN2wkGxByIww-1; Wed, 04 Mar 2020 13:06:40 -0500 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 4956E100550E; Wed, 4 Mar 2020 18:06:34 +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 2CCDD7388D; Wed, 4 Mar 2020 18:06:32 +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 4766786A01; Wed, 4 Mar 2020 18:06:28 +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 024I6QVO030449 for ; Wed, 4 Mar 2020 13:06:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id D08B02063FE6; Wed, 4 Mar 2020 18:06:26 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CBE002063FE5 for ; Wed, 4 Mar 2020 18:06:24 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (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 A20E41017E56 for ; Wed, 4 Mar 2020 18:06:24 +0000 (UTC) Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-279-qywsopUoNcWuocgUyordJA-1; Wed, 04 Mar 2020 13:06:22 -0500 Received: by mail-pf1-f195.google.com with SMTP id l7so1341548pff.6 for ; Wed, 04 Mar 2020 10:06:21 -0800 (PST) Received: from localhost.localdomain ([139.5.254.126]) by smtp.gmail.com with ESMTPSA id c20sm13512398pfc.140.2020.03.04.10.06.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2020 10:06:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583345203; 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=6+iPYs+mS98P+zSQ/MdiSrT3zJtSzTRzFi3nUypxp78=; b=N53iQbKl+64cozxe9Ia4VaKauYx//VMaxNBWOQE8XSJxsXX5Pjy3v6gF6H1c13BnzhWTZb XeMZA1D6u7WQ68z+NkXvpX8eNEiRPLJudWLtwJ9xKdqXmn16HhLJRYkFhGzVXlB7kzMfWk z4ZBBfztj43dQ2F6Xo6oN9ndr44GHn4= X-MC-Unique: VdyZCtLBNZqN2wkGxByIww-1 X-MC-Unique: qywsopUoNcWuocgUyordJA-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=63Ohdm7V100yNxzkhPFdiiK/DidYrJlwl5ivo91aeq4=; b=Mngg0jW1YDy9YRKEsKFyp4Csjwbgq5HNXAD0MTWFX4NvFBBTT9KS8VnGdxddymQqlB 3GlROBzZBcNQC4zPMaMlWSWspbo84ET7C634xwF9zQ6Biks3fuShr5gW1GtOk7CR/AHp OVXqswigoZnJqTZ1cNla0Q08OKt6+fVWEWdRLV6pPwGMPsEP/RJoLXtSXHtBoBZl3oiy lNkmReQH7fBFNJ3NfGthl+UKLscQt+dZt5URGVVWHJBR7wIskytU992lb74hVeLG7pb3 Hy1Ebbpo5GXZvKe6jZ/PWwecLg8UL1BOe1uh/s35CVxrB92r116uDe/DkX4Cft2xw9u3 3ePg== X-Gm-Message-State: ANhLgQ3Ox+nRhuPNWS3dX8eMSmo96G8xLDSUKmhGSteippuWHaJbe38H uClC4sWNKOHGjbiElq5UgeFRuOw8 X-Google-Smtp-Source: ADFU+vtXjJfWy3+7w1PXKUQ69Nkg2upbdfiyxFUV9aWOFOWJXMDa0gUXSfQkFF9pBUkFYXErs1LwYA== X-Received: by 2002:a63:f962:: with SMTP id q34mr3545715pgk.229.1583345180599; Wed, 04 Mar 2020 10:06:20 -0800 (PST) From: Gaurav Agrawal To: libvir-list@redhat.com Subject: [PATCH v4] admin: use g_autofree Date: Wed, 4 Mar 2020 23:36:13 +0530 Message-Id: <20200304180613.134120-1-agrawalgaurav@gnome.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 024I6QVO030449 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.79 on 10.5.11.15 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" Signed-off-by: Gaurav Agrawal Reviewed-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko --- src/admin/libvirt-admin.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/admin/libvirt-admin.c b/src/admin/libvirt-admin.c index 4099a54854..709e009467 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,13 @@ 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