From nobody Mon Feb 9 15:45:44 2026 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; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576749929; cv=none; d=zohomail.com; s=zohoarc; b=m/udb3gSPATMbXaHYZgJsdiOcmHPTEFn9Sxx10izAGi0wsFFnc4n18lfPjQXmWi40tEaLSm6QDcEE9qegdvJPIMXKglVWHh4v9oPULHnodyBvbBPS+CpdgKQ0AXAGmT8s8uDDoz2wCYGWHLQCE84sVTGAamCkUgl1IPG8YnH8Cc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576749929; h=Content-Type:Content-Transfer-Encoding:Cc: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=MylKQP86af955gQhiYHNorG0QcW3Rgh2vEkMWSUAN5U=; b=GrUZTD0rvNhaxjkAu1nAK84ROa3fQ2RQuFpsr1s96F1hYffHqesmWeXqw24SNWrEs6Z3H+tFyenonHQU7Mu1/4xHtwyPZNT535htxa72gpdRGka45l/vTa+FhJYt3tW8k6yxV//0AtCAsVtb+QSJiK5vq3xto/Hnw6uJgveljQY= 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; dmarc=pass header.from= (p=none dis=none) header.from= 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 1576749929439925.0919741844251; Thu, 19 Dec 2019 02:05: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-320-_mAXyD4COniVT7lrSh3RFQ-1; Thu, 19 Dec 2019 05:05: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 2BC42801E6C; Thu, 19 Dec 2019 10:05:21 +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 ED9E260C87; Thu, 19 Dec 2019 10:05:20 +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 99FDA18089CD; Thu, 19 Dec 2019 10:05:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBJA4uIL010785 for ; Thu, 19 Dec 2019 05:04:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0939E26DF9; Thu, 19 Dec 2019 10:04:56 +0000 (UTC) Received: from laerte.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5B6A326E4B; Thu, 19 Dec 2019 10:04:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576749928; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=MylKQP86af955gQhiYHNorG0QcW3Rgh2vEkMWSUAN5U=; b=CuKv+J8FH/jK6qHJdYh8nC0mOeasFiTKBMxL5ecU41zI5D0fM+bz4MZGINtCsb9Akzuhn+ 7zzpdABH246qPG61P24Ed3aHg7UDgglRoVbrqxBTA0w9OZqbQIeirIIgj8CUt7a8Liam79 rFTMx3Ou7ndJNJD6Jo+9m7oWQxRbTyc= From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Thu, 19 Dec 2019 11:04:07 +0100 Message-Id: <20191219100447.210836-3-fidencio@redhat.com> In-Reply-To: <20191219100447.210836-1-fidencio@redhat.com> References: <20191219100447.210836-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCH 02/42] vbox: Don't leak virGetUserDirectory()'s output 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-MC-Unique: _mAXyD4COniVT7lrSh3RFQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) On vboxStorageVolCreateXML(), virGetUserDirectory() was called without freeing its content later on. Signed-off-by: Fabiano Fid=C3=AAncio Reviewed-by: J=C3=A1n Tomko --- src/vbox/vbox_storage.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/vbox/vbox_storage.c b/src/vbox/vbox_storage.c index 790b0e4997..7f240c5333 100644 --- a/src/vbox/vbox_storage.c +++ b/src/vbox/vbox_storage.c @@ -410,6 +410,7 @@ vboxStorageVolCreateXML(virStoragePoolPtr pool, resultCodeUnion resultCode; virStorageVolPtr ret =3D NULL; g_autoptr(virStorageVolDef) def =3D NULL; + g_autofree char *homedir =3D NULL; =20 if (!data->vboxObj) return ret; @@ -442,8 +443,10 @@ vboxStorageVolCreateXML(virStoragePoolPtr pool, } =20 /* If target.path isn't given, use default path ~/.VirtualBox/image_na= me */ - if (!def->target.path) - def->target.path =3D g_strdup_printf("%s/.VirtualBox/%s", virGetUs= erDirectory(), def->name); + if (!def->target.path) { + homedir =3D virGetUserDirectory(); + def->target.path =3D g_strdup_printf("%s/.VirtualBox/%s", homedir,= def->name); + } VBOX_UTF8_TO_UTF16(def->target.path, &hddNameUtf16); =20 if (!hddFormatUtf16 || !hddNameUtf16) --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list