From nobody Sun Feb 8 10:04:24 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.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 207.211.31.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=1596473913; cv=none; d=zohomail.com; s=zohoarc; b=A+dqyoa+DGhbe7hNvS61CXQdnGzTNcx0dW9vWSMPGtHYB9Z6oW1R0IgujNkQUcvk/MVfMC3605HQ7d/nHiko6VhrHgVr9/8s1IzJSgV8E9WhXEc11lxrzUmgMB/IQUBwOP1EEpPIdHQae2pOXniPlCtEr9fN9pBW2io2CTl4x4M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596473913; 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=WqyN3LxIrT/xwKkLfQzPmz1HeepSbAYd2xMaO1584YU=; b=CQpN/SDSOojGYJeO75zMzzF74aP+/DvaOXJAJI9oGUonv8auPdYxUmUN9JJIL3wOjc5jRTOx5lqRe6R9Hds6EE8IoUCmwTCuIslQUnmFlSwa+EYfDIH7TTIRaXPmU7yldnT5WWLBtjHfu5H+DYileT/NFq72ydhBGPIzINCB27I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.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 [207.211.31.120]) by mx.zohomail.com with SMTPS id 1596473913911929.4052350281988; Mon, 3 Aug 2020 09:58:33 -0700 (PDT) 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-161-oupz6_6GN1uuXShspCOPoA-1; Mon, 03 Aug 2020 12:58:30 -0400 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 5F8061902EA0; Mon, 3 Aug 2020 16:58:23 +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 3AF1D1010404; Mon, 3 Aug 2020 16:58:23 +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 0B14A1800B71; Mon, 3 Aug 2020 16:58:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 073Gv71M007659 for ; Mon, 3 Aug 2020 12:57:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 89CAA71775; Mon, 3 Aug 2020 16:57:07 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id D8C3671770 for ; Mon, 3 Aug 2020 16:57:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596473912; 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=WqyN3LxIrT/xwKkLfQzPmz1HeepSbAYd2xMaO1584YU=; b=G1UBcmtSEj2wU6sL3Q/5NweyezFXI3MrGCVD41C5dTUoqxRfs9yjWTKt2MoRJAVpZiz3HO otAhaarPL646CJ7LgvIw+evq2/ZlP2OTnENSwNCjnNN2N9ty2XCbTUJ+RS3h8sHlXI1xDf qpVq+pU68rYLJS1lPzXd1tkoU3HptOo= X-MC-Unique: oupz6_6GN1uuXShspCOPoA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 04/19] util: move declarations in virStorageFileChainLookup Date: Mon, 3 Aug 2020 18:56:41 +0200 Message-Id: <1d5aef9fe56014fb01f64f042cf40ded88acf713.1596473604.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Use g_autofree and move the declarations to the beginning of the block. Signed-off-by: J=C3=A1n Tomko --- src/util/virstoragefile.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 00d8e16ef9..f529f0faf3 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -1597,7 +1597,6 @@ virStorageFileChainLookup(virStorageSourcePtr chain, { virStorageSourcePtr prev; const char *start =3D chain->path; - char *parentDir =3D NULL; bool nameIsFile =3D virStorageIsFile(name); =20 if (!parent) @@ -1626,15 +1625,16 @@ virStorageFileChainLookup(virStorageSourcePtr chain, break; =20 if (nameIsFile && virStorageSourceIsLocalStorage(chain)) { + g_autofree char *parentDir =3D NULL; + int result; + if (*parent && virStorageSourceIsLocalStorage(*parent)) parentDir =3D g_path_get_dirname((*parent)->path); else parentDir =3D g_strdup("."); =20 - int result =3D virFileRelLinkPointsTo(parentDir, name, - chain->path); - - VIR_FREE(parentDir); + result =3D virFileRelLinkPointsTo(parentDir, name, + chain->path); =20 if (result < 0) goto error; --=20 2.26.2