From nobody Mon May 6 07:11:06 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=1583113956; cv=none; d=zohomail.com; s=zohoarc; b=cog0Zg+IzOm2rEa/1ae6kotPNEpVsdtknwx/z6T+/h029xpdUTgUDRQsaeJFKXNYJ+LIPJR7U0h/GUQyvf4cBcQiQqGUASbgBtP/33iDqc6zGWrsga2CMdSyvJKqUc6zNZ/hG5hFLaf6IijfXV7vjCAlfqgmjIS75XVauAiQplI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583113956; 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=gdWGiyYCg04K8ckWVArjDZ4GHLZDinCXQhbj+ADMZBQ=; b=kzmLnVLzXx7nS7SwX8HD2tl6D+BBzd/jYxu9b+etZ3ItYxMh/1aIBp0QylPabHoYs0ss2Jrdb9ATGHCmseyNs5uD/lUBL8cqfPd3tMRnOZCpvMHfZwFzFbx+5b9ArWrkYUhrZn22MyFhTu9mGHQ/MUXVjQgUzmpyvPXUNXWVsD0= 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 1583113956755722.1590375871556; Sun, 1 Mar 2020 17:52:36 -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-166-9i83fpp3Pfa6CQR6bT2nCA-1; Sun, 01 Mar 2020 20:52:33 -0500 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 6057218CA244; Mon, 2 Mar 2020 01:52:25 +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 D4B7260BF3; Mon, 2 Mar 2020 01:52:24 +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 30B8F86A01; Mon, 2 Mar 2020 01:52:23 +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 0221qLhP024736 for ; Sun, 1 Mar 2020 20:52:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8DBB16C32E; Mon, 2 Mar 2020 01:52:21 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 897A36C355 for ; Mon, 2 Mar 2020 01:52:19 +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 5F5DF805A87 for ; Mon, 2 Mar 2020 01:52:19 +0000 (UTC) Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-354-M3bx2Wr-ONWZIcRNWQM8GA-1; Sun, 01 Mar 2020 20:52:17 -0500 Received: by mail-pj1-f68.google.com with SMTP id 12so3723015pjb.5 for ; Sun, 01 Mar 2020 17:52:17 -0800 (PST) Received: from localhost.localdomain ([2401:4900:463a:9f0b:4030:3477:ba2b:3b5c]) by smtp.gmail.com with ESMTPSA id j4sm18743547pfh.152.2020.03.01.17.52.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Mar 2020 17:52:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583113955; 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=gdWGiyYCg04K8ckWVArjDZ4GHLZDinCXQhbj+ADMZBQ=; b=SUcXEb0FbqxpATVXKII/axC04gHe2EvEXx/Y3VWJuumen1I5irSlrwx+jpO+EdKVgk2ubt q1BkWfb/sfqKnlYm/Y2SMNuedcj1s3UcMU/hP+4ff90xFYlP3te1vgeXLlVp1RSr9avhoG P5I4uckQSJWyfE4gpaPYMAHjtlqZNqY= X-MC-Unique: 9i83fpp3Pfa6CQR6bT2nCA-1 X-MC-Unique: M3bx2Wr-ONWZIcRNWQM8GA-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=m1nSyMsUcgdN0vav2dv1/lnGAQjX+LQ671pKW70n69U=; b=X3k8aFqkt1TUv15mLBzIUSOqD/pBrpJ+7ck82b/TNqoRqzysD7EA2pBfqlenLaSNfd weq+ao5iRBo8hRanTEgMWONsZ7FcSeI89Cmly8H/K3fFY/ioiO3ozRteJdRpiZ72RbYM ykFxgS3bUu8iIR3FI3l6MyEiHLDlv9EDl3zEwBvpNeYcB2AtkkTkVkrbAwLjWrI4vrek +Vg1axCAe0x6lTOY6DeswcDnEwekFPj9vIg0iLRCNzlnpBknEiAXQdUZbLDv60z2GaMf 4XOqQTRHYn9/Vgu3/DZuwyjaXaBA0AWsTDiXGz6JTYEqR/8HYxwg5T4zAzMk4B3DHUVq YrtA== X-Gm-Message-State: APjAAAUEL8zpjCJ8xTrpVsgsomKba++Od5B9J+VUTsLYQCoagd6OVdyq W0AAvf8CytOc9MUFYPtyaukZRz+ynD0= X-Google-Smtp-Source: APXvYqwNbVktm1qaNCsvc+GLX+xfS+G29Eu4p0En6j4e6X2sURGw0RuSgf2FOTcdA4NIYgeKxIqGHQ== X-Received: by 2002:a17:90a:1f8d:: with SMTP id x13mr19094634pja.27.1583113935745; Sun, 01 Mar 2020 17:52:15 -0800 (PST) From: Gaurav Agrawal To: libvir-list@redhat.com Subject: [PATCH] admin: use g_autofree Date: Mon, 2 Mar 2020 07:22:03 +0530 Message-Id: <20200302015203.12043-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 0221qLhP024736 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.12 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 --- 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..e272d7a422 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