From nobody Mon Feb 9 17:25:07 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1612600421; cv=none; d=zohomail.com; s=zohoarc; b=B2NnFpJTz5hXjv+nGmBiSThlYvSbHnHC2Q3ClMrOycpPZMK8IcaNv0T0ureCpM0YLl+vw9celSqVTWD5sZdWWtdJ5EonE0eC9gHVE65wEVyH/kAaQNDe1L+wyMOc4y7b8C1XgG83k6qpLcXgFdCwevUqPIj39o8hQ9jqO+5cnYo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612600421; 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=AyD15jAwVuQ52Q3XuLxT4U3XrN++vCNgZVas49fc6ck=; b=IhSMGB5ggEHqe1+zrRN36zHEWw8yZtkFhcgWruVkGcyOraj3okgDBYSil4olOGJ3fswowjpDlYDiOqTLTQi94vR857HTx3K2LNTHfE+W5SPkiw5mgyBVBWzFHV40M8ee7ht9mRSPeBsZY2+pBTAUu4kDXfUcVtMgUndeDrkHqWs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1612600421825390.47077198933766; Sat, 6 Feb 2021 00:33:41 -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-215-cpeiw-B5Op-LJzFG_i7i9A-1; Sat, 06 Feb 2021 03:33:38 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E86A68030D3; Sat, 6 Feb 2021 08:33:32 +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 C40645C290; Sat, 6 Feb 2021 08:33: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 8BE7958074; Sat, 6 Feb 2021 08:33:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1168XH7R004709 for ; Sat, 6 Feb 2021 03:33:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3348660C78; Sat, 6 Feb 2021 08:33:17 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 84A1E60C77 for ; Sat, 6 Feb 2021 08:33:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612600420; 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=AyD15jAwVuQ52Q3XuLxT4U3XrN++vCNgZVas49fc6ck=; b=IjW18GmusYC7VXSP/JqtFlppUcGHpdZmCTN4DXKFxOYGoPEYMLM8teEHc+fAcKupWf9gya 1xh7Ch7gkoTaqoE4JM/qZj6h7dQoQmxwf/NmTZaR2IovCFlzVDrt2DFvZWf7R2dPsEcGWj dDYB0G49WJuU9Uiy7HAP9gt76axt2HE= X-MC-Unique: cpeiw-B5Op-LJzFG_i7i9A-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 06/40] qemuNamespaceUnlinkPaths: Fix inconsistent cleanup handling Date: Sat, 6 Feb 2021 09:32:28 +0100 Message-Id: <62da6382801f3bddec3ca9798a712aaed0b270c5.1612599659.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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" Some code paths return -1 directly while others jump to 'cleanup' which cleans the list of mounts. Since qemuDomainGetPreservedMounts now returns a NULL-terminated list, convert devMountsPath to g_auto(GStrv) and remove the cleanup altoghether; Signed-off-by: Peter Krempa --- src/qemu/qemu_namespace.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c index 03cc6379fe..af08b3e055 100644 --- a/src/qemu/qemu_namespace.c +++ b/src/qemu/qemu_namespace.c @@ -1341,11 +1341,9 @@ qemuNamespaceUnlinkPaths(virDomainObjPtr vm, virQEMUDriverPtr driver =3D priv->driver; g_autoptr(virQEMUDriverConfig) cfg =3D NULL; g_auto(GStrv) unlinkPaths =3D NULL; - char **devMountsPath =3D NULL; - size_t ndevMountsPath =3D 0; + g_auto(GStrv) devMountsPath =3D NULL; size_t npaths; size_t i; - int ret =3D -1; npaths =3D virStringListLength(paths); if (!npaths) @@ -1353,10 +1351,8 @@ qemuNamespaceUnlinkPaths(virDomainObjPtr vm, cfg =3D virQEMUDriverGetConfig(driver); - if (qemuDomainGetPreservedMounts(cfg, vm, - &devMountsPath, NULL, - &ndevMountsPath) < 0) - goto cleanup; + if (qemuDomainGetPreservedMounts(cfg, vm, &devMountsPath, NULL, NULL) = < 0) + return -1; for (i =3D 0; i < npaths; i++) { const char *file =3D paths[i]; @@ -1387,10 +1383,7 @@ qemuNamespaceUnlinkPaths(virDomainObjPtr vm, unlinkPaths) < 0) return -1; - ret =3D 0; - cleanup: - virStringListFreeCount(devMountsPath, ndevMountsPath); - return ret; + return 0; } --=20 2.29.2