From nobody Sun May 5 08:17:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; 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 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1582982299; cv=none; d=zohomail.com; s=zohoarc; b=hXRFFdF6w8zF7N6luPKjW6LR3lkqb95wbIbcIpKfTzRrymqJWRpESfM/4RUEaS1gyYFv8F2wCke8uTr4niTl/I+jsmJl8ZO9nAL4HNPppHgitmTf7q06QwaTIzYxBGLZdUctsswx9bGt7weKbosZ3pcxmkM18xWg3WEziF2ICNk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582982299; 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=8HAy3RlMnDzILvgRAh0D2PuoNy1rghTNDJxfpGN3JDs=; b=ZO+mDNBm8l/MsBdUMGHrSg2kNAdaTU9gb4IRe7U7xVoqPd0DtzpyfGdU4XIEp4rrI0KEQTIlZx/NPZy9DPB1NXL4b/c2CzfXOifHcbuJts0c1Abyczn6N7AlnEQBooUHaR0bfEefUxuRWvJao5k23m2Ffr67HYwP3MiNappQycE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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 [207.211.31.81]) by mx.zohomail.com with SMTPS id 1582982299261572.6723095111382; Sat, 29 Feb 2020 05:18:19 -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-193-CXVUdwsKMR2QTTCm6gnTFw-1; Sat, 29 Feb 2020 08:18:15 -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 9A5241005514; Sat, 29 Feb 2020 13:18:08 +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 14A3A60BEC; Sat, 29 Feb 2020 13:18:06 +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 A8AA4181AC26; Sat, 29 Feb 2020 13:17:59 +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 01TDHvqZ001907 for ; Sat, 29 Feb 2020 08:17:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4670F2038B80; Sat, 29 Feb 2020 13:17:57 +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 418D42026D69 for ; Sat, 29 Feb 2020 13:17:55 +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 212B1101A55D for ; Sat, 29 Feb 2020 13:17:55 +0000 (UTC) Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-47-Wia3esDzNJ2RWK-vvv821g-1; Sat, 29 Feb 2020 08:17:52 -0500 Received: by mail-pg1-f193.google.com with SMTP id d9so3008028pgu.3 for ; Sat, 29 Feb 2020 05:17:52 -0800 (PST) Received: from localhost.localdomain ([2401:4900:4638:7241:49e3:5627:d00e:c998]) by smtp.gmail.com with ESMTPSA id x7sm11134769pgp.0.2020.02.29.05.17.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Feb 2020 05:17:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582982297; 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=8HAy3RlMnDzILvgRAh0D2PuoNy1rghTNDJxfpGN3JDs=; b=M0lSBt39N9pVccohI4hERSJU0/yJoSKJCJmUvg34QBSNon9HhvILuVKYLYFkAioP9VQZD2 o1zaHs6c7MtGjZRuGuco78bZCaMPm446hA3a7uxGIqv7kSxUkfJ9FSKhpdKjrM4kcQMkxw eFOlw0uLIqvCc1J8lQsIj0ZZv5g941U= X-MC-Unique: CXVUdwsKMR2QTTCm6gnTFw-1 X-MC-Unique: Wia3esDzNJ2RWK-vvv821g-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=mMdmn58ihA20QhLWb4ZP2MdYAvT1GAGzQ0q8m89qxmg=; b=OailvpP828pGrdmzRE8ElOMoPPnnumbO860XeilTfg77Sqcp9J2Wwhd1aTqTbT2KIN Port1BYDw/MJYNxI3WsLFXFAUJx5PSSL7ltmAoWVs30dcXEaKOxGUDH8ktqbZ/tmbg8a NKmKphtyeC+MwNbY3GJxcD/zzD3VnwpZxc+pdzk9lUm0WXLSGniItlMS/Eo9NB5KCi69 rH5mckXb+gyNVbf+Q4a+Dfz8oyPW1HJ+rZuIrBEPaTegrTEIH8CXerKCxYWaE6bje9xs j2v9GkJtymm1x33iDBhvNZ6IXc9wDtTtX7y65zS8UNPhNSBJACGglZoG+KnZnNB6jfg8 tK5A== X-Gm-Message-State: APjAAAVSdPYP/W+ZpF94s0fhu19JujXRgjPU6MEtubcmodONv77DMFo4 KCu/Aq7DLAZtn8By+QaRfR5OyEs5FSk= X-Google-Smtp-Source: APXvYqzY9CL92EILzzHDQ1qk+w6QJu/jvcX2q50SJo0AdIs/ecM55922Iur87AtRaAVJsjYR9iqr4g== X-Received: by 2002:a63:df0a:: with SMTP id u10mr9926920pgg.282.1582982270918; Sat, 29 Feb 2020 05:17:50 -0800 (PST) From: Gaurav Agrawal To: libvir-list@redhat.com Subject: [PATCH] admin: use g_autofree Date: Sat, 29 Feb 2020 18:47:38 +0530 Message-Id: <20200229131738.14518-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 01TDHvqZ001907 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" From: GAURAV AGRAWAL Signed-off-by: Gaurav Agrawal --- 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..d841a15f95 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,14 +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); +cleanup: return conn; =20 error: virDispatchError(NULL); - virObjectUnref(conn); conn =3D NULL; goto cleanup; } --=20 2.24.1