From nobody Sat Apr 27 21:39:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1616497148; cv=none; d=zohomail.com; s=zohoarc; b=f6RiSlBz8VucHzlnbL64X0ma3eW3+Kb+u4GqWwIHc7v6SY4U/VdqnJJMTq2xkUKjUcpEhcmhudJgXfqhkHjLcMSj0XyRMbbN7RfONRYeeQGZjZd6XLqSSrsrgaa+JbtxIcTN7n4A6a/07Gm5CVm0yMFJLo5jx7eWK05sWfcUQBA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616497148; 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=8jLkBrPLjtcf8g7Py67J3HzGkF6qByCA81uDtiqI+vg=; b=HFuer6RGaZ/MUHD/xKgZUK7nogk8Ap2IepHHhVcGuw/sKw7xPjurmZLXqJB+hhHM9es4/10KoIkb/Y8yrlxWgyU92AYWaBZ2mZYuZjSvblC4N5TItS+t4GeyefMJpBNV87TAq73RtH8y0CEM5MmLZUbB4XI/54lDS3CwOeqUDMA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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 [170.10.133.124]) by mx.zohomail.com with SMTPS id 1616497148489521.9402129211179; Tue, 23 Mar 2021 03:59:08 -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-12-0KXnQ-XvOrelNimpEy672Q-1; Tue, 23 Mar 2021 06:59:04 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A94FF180FCAD; Tue, 23 Mar 2021 10:58:59 +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 86B219CA0; Tue, 23 Mar 2021 10:58:59 +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 AD82D1809C83; Tue, 23 Mar 2021 10:58:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12NAwvWQ020293 for ; Tue, 23 Mar 2021 06:58:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id D77BC9CA0; Tue, 23 Mar 2021 10:58:57 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id 58E616E6FF for ; Tue, 23 Mar 2021 10:58:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616497147; 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=8jLkBrPLjtcf8g7Py67J3HzGkF6qByCA81uDtiqI+vg=; b=HFgYfxJnyI/Xg56Qi9m+3dnc7Zt/HKEHqCu3mpsi/37paqrhAVlBfA1yVk157JxuB1oxBv 91Pi2lFehKQO2Gsgt42ipsCfTPnCJtovXCAF6yXClPNwFTZqR5gUWqEkyyrHwcISJB+pvs xes467yU52Sa4Dbq6ZxhHme/Kx8agWo= X-MC-Unique: 0KXnQ-XvOrelNimpEy672Q-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/2] domain_conf: Separate virDomainOS clear into a function Date: Tue, 23 Mar 2021 11:58:48 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.11 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" The virDomainDefFree() function frees individual members of virDomainDef struct. The function is already long enough, move code that handles def->os member into a separate function. Signed-off-by: Michal Privoznik --- src/conf/domain_conf.c | 54 ++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 95602ae57e..3aefa8f335 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3527,6 +3527,36 @@ virDomainSEVDefFree(virDomainSEVDefPtr def) g_free(def); } =20 +static void +virDomainOSDefClear(virDomainOSDef *os) +{ + size_t i; + + g_free(os->machine); + g_free(os->init); + for (i =3D 0; os->initargv && os->initargv[i]; i++) + g_free(os->initargv[i]); + g_free(os->initargv); + for (i =3D 0; os->initenv && os->initenv[i]; i++) { + g_free(os->initenv[i]->name); + g_free(os->initenv[i]->value); + g_free(os->initenv[i]); + } + g_free(os->initdir); + g_free(os->inituser); + g_free(os->initgroup); + g_free(os->initenv); + g_free(os->kernel); + g_free(os->initrd); + g_free(os->cmdline); + g_free(os->dtb); + g_free(os->root); + g_free(os->slic_table); + virDomainLoaderDefFree(os->loader); + g_free(os->bootloader); + g_free(os->bootloaderArgs); +} + =20 void virDomainDefFree(virDomainDefPtr def) { @@ -3640,29 +3670,7 @@ void virDomainDefFree(virDomainDefPtr def) g_free(def->idmap.uidmap); g_free(def->idmap.gidmap); =20 - g_free(def->os.machine); - g_free(def->os.init); - for (i =3D 0; def->os.initargv && def->os.initargv[i]; i++) - g_free(def->os.initargv[i]); - g_free(def->os.initargv); - for (i =3D 0; def->os.initenv && def->os.initenv[i]; i++) { - g_free(def->os.initenv[i]->name); - g_free(def->os.initenv[i]->value); - g_free(def->os.initenv[i]); - } - g_free(def->os.initdir); - g_free(def->os.inituser); - g_free(def->os.initgroup); - g_free(def->os.initenv); - g_free(def->os.kernel); - g_free(def->os.initrd); - g_free(def->os.cmdline); - g_free(def->os.dtb); - g_free(def->os.root); - g_free(def->os.slic_table); - virDomainLoaderDefFree(def->os.loader); - g_free(def->os.bootloader); - g_free(def->os.bootloaderArgs); + virDomainOSDefClear(&def->os); =20 virDomainClockDefClear(&def->clock); =20 --=20 2.26.2 From nobody Sat Apr 27 21:39:45 2024 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=1616497427; cv=none; d=zohomail.com; s=zohoarc; b=YTGuFEHKaNPU3LssvJrFPAwuUZnElHwqXVQgS9KkBOHL50aNwNnvWva/Ff6TwYp3hQoJR9AzUR6erWglavdtomKy5z19GexzpZP39MqV7f/8aubdixQYiDZv5NMQOC7uN4V568/eeLRbhUcBFQhr88KaY4zQSZ9ew7XMPRDYT28= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616497427; 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=ns/JIv5/i6cUz6PwZHzMkZZy6WlSVjgYFevHNMsTuX8=; b=danvv/3YExRDl0JDV7wOWYM02UxV7X9MyHj+gjqw58ZVf1rO7j99a/AmB15C2r1ZhPvZ3tuPyp/tDqjnURptyfJrbM3symuZZSqvC5LaPeWAWGKzVG4T6wOl6Au6GezrPEqVcZUHIEAIGLJrIA9YLaxLleHoKlRTIEQsz6243Cs= 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 1616497427876149.15119160089887; Tue, 23 Mar 2021 04:03:47 -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-185-xUHAiVe4O8SmZ9ZpK9GU8w-1; Tue, 23 Mar 2021 07:03:44 -0400 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 38C61881283; Tue, 23 Mar 2021 11:03:38 +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 F1D09171E2; Tue, 23 Mar 2021 11:03:37 +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 3052D1809C83; Tue, 23 Mar 2021 11:03:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12NAwwnh020301 for ; Tue, 23 Mar 2021 06:58:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id B357C179B3; Tue, 23 Mar 2021 10:58:58 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id 34E909CA0 for ; Tue, 23 Mar 2021 10:58:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616497426; 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=ns/JIv5/i6cUz6PwZHzMkZZy6WlSVjgYFevHNMsTuX8=; b=Ly5qudaWbqMO772AsSPVsXRSAk6ZGkvV7yI63W1ZRLYxbe2iJqRj9RhN41DbYuP3uLjNap vjupEMqVZZN5qbWe0fbE2NoP9hh6PFCsfQq8azAFQCn39o5zYaBQuGcNL8ysRqk+0Ef18S XBmI63JbYyj8ztlBx4l4eAhGYSmxugs= X-MC-Unique: xUHAiVe4O8SmZ9ZpK9GU8w-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/2] domain_conf: Don't leak def->os.firmwareFeatures Date: Tue, 23 Mar 2021 11:58:49 +0100 Message-Id: <856d916f84d5082faf1fc3afd33ade9393f60098.1616497109.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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" The firmwareFeatures member of virDomainOSDef struct is allocated in virDomainDefParseBootFirmwareOptions() but never freed. Signed-off-by: Michal Privoznik --- src/conf/domain_conf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3aefa8f335..9bf12ff599 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3532,6 +3532,7 @@ virDomainOSDefClear(virDomainOSDef *os) { size_t i; =20 + g_free(os->firmwareFeatures); g_free(os->machine); g_free(os->init); for (i =3D 0; os->initargv && os->initargv[i]; i++) --=20 2.26.2