From nobody Mon Feb 9 12:11:29 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1583401949; cv=none; d=zohomail.com; s=zohoarc; b=B/wZUYykUMgjvMqVYtLcHBu8wLeSrrxc8idgq+FDeYDPmo6zCPQMFrnJJdVTo0oMGLNhFB9MgYjMTqUL69gAhSCqSkbJRK0WE0hqRIKKdzK3rIyVaVXMK0GNCY6ctQrEcWwShlIfPi4+RG94EjeC3VNKXMzXJTgImbucDnZUxac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583401949; h=Content-Type:Content-Transfer-Encoding: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=JRCOqjJUrbWT4/j6KOV3hmp2UmC/a+VfuEndxfjCpEs=; b=kx/mRUU/W+9cbWGSBUEU/3vi/f3Ur+ULysJxveKEeA83OUejLWcpC6a+8phZ76F5KDOMFehBgxaxPswQLWhqaynA976B/ilvLT+NvxBvbispnGmCAqELoEA2lq7ArAaCpF9LsYrvJo53OUR0iUpnI7wSe69Y/p3yBX1Z97AYvlQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1583401949937222.95043200414273; Thu, 5 Mar 2020 01:52:29 -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-488-r0d-HE_ZOhmkm4CTJ71RQw-1; Thu, 05 Mar 2020 04:52:26 -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 B6C8B8014D8; Thu, 5 Mar 2020 09:52:17 +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 8348360CDA; Thu, 5 Mar 2020 09:52:17 +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 3377786A06; Thu, 5 Mar 2020 09:52:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0259q7Rf023321 for ; Thu, 5 Mar 2020 04:52:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id A6C0B90779; Thu, 5 Mar 2020 09:52:07 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2CCD890538 for ; Thu, 5 Mar 2020 09:52:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583401948; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=JRCOqjJUrbWT4/j6KOV3hmp2UmC/a+VfuEndxfjCpEs=; b=gQEsDJ2n72Jlcw72VDJb0gUgUHMpwZaNtOKBDqYVtcWDtxM5ofct38DLwblKb0jWXgiHXa 3/giBI93PH/RLeUzY6rwPgcdZkDyS0GNLn3EsrOxB2ikk02BDCeGTBY52kISecJcgSSXRh 8kyvwYln741VikQxs7tQ7keCebPpAdU= X-MC-Unique: r0d-HE_ZOhmkm4CTJ71RQw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/5] virNetworkPortDefSaveStatus: Fix potentially uninitialized 'path' by refactoring cleanup Date: Thu, 5 Mar 2020 10:51:58 +0100 Message-Id: <80124ad030bfa8daa46cb1b62548411122b27b55.1583401776.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com 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" Use 'g_autofree' to clean both 'path' and 'xml' which mandates initialization and get rid of the 'cleanup' label and 'ret variable. Signed-off-by: Peter Krempa --- src/conf/virnetworkportdef.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/conf/virnetworkportdef.c b/src/conf/virnetworkportdef.c index b58e2ccae0..a4cffea8b6 100644 --- a/src/conf/virnetworkportdef.c +++ b/src/conf/virnetworkportdef.c @@ -444,29 +444,24 @@ virNetworkPortDefSaveStatus(virNetworkPortDef *def, const char *dir) { char uuidstr[VIR_UUID_STRING_BUFLEN]; - char *path; - char *xml =3D NULL; - int ret =3D -1; + g_autofree char *path =3D NULL; + g_autofree char *xml =3D NULL; virUUIDFormat(def->uuid, uuidstr); if (virFileMakePath(dir) < 0) - goto cleanup; + return -1; if (!(path =3D virNetworkPortDefConfigFile(dir, uuidstr))) - goto cleanup; + return -1; if (!(xml =3D virNetworkPortDefFormat(def))) - goto cleanup; + return -1; if (virXMLSaveFile(path, uuidstr, "net-port-create", xml) < 0) - goto cleanup; + return -1; - ret =3D 0; - cleanup: - VIR_FREE(xml); - VIR_FREE(path); - return ret; + return 0; } --=20 2.24.1