From nobody Sun Apr 28 14:43:03 2024 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=1592307555; cv=none; d=zohomail.com; s=zohoarc; b=SV6vBeQH+A/3PmduvbM+RRiGOO6rO7ZKRJNWN60FReRqfCd7q0wAjxIOmeZZhzAGS4fffS0/CLeB16WYmxDfKJgDoihlqeiDP7CZzFAFsmS6G4hWwDeJaHPnmD1bXbzjAKlatjQEytfTJoB9iFObgbRdLtt5NcPMhB+hHDLEo3A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592307555; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=nef8YtyxWMVjPHxHa0vwgesWlArkXzxGH7M9QcDLVRo=; b=cugHdyO1I8WCqlUxvROUKht9tdq6OB+8/OQQWag7G0sH7cnTywGUXkI5mbYQGzBtGPqhCn2rP9KNjUroOlS6gSCjuN8ARrOudprK+si1GFkW+fPC1VIWiGzHoribv2bJG20wwh5M9o+xNzlEAzzTUIwoLgTecYakvZDGhm7HBaE= 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 1592307555514300.2640043426733; Tue, 16 Jun 2020 04:39:15 -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-249-vBr3dikeMOaK_6MprS5tQQ-1; Tue, 16 Jun 2020 07:39:12 -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 952D31185F80; Tue, 16 Jun 2020 11:39:06 +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 A1AF979301; Tue, 16 Jun 2020 11:39:05 +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 3E18A833A4; Tue, 16 Jun 2020 11:39:03 +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 05GBd2UT028614 for ; Tue, 16 Jun 2020 07:39:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 15F1419C79; Tue, 16 Jun 2020 11:39:02 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.154]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8ABE219C71 for ; Tue, 16 Jun 2020 11:38:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592307554; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=nef8YtyxWMVjPHxHa0vwgesWlArkXzxGH7M9QcDLVRo=; b=P0sQr4K1cK6HQlEvO3LRGKBMkL4BvKYu6P+qKpptT8zvfqYwmWFCgBc6YmKNJWawkOSAy0 /5hZ3akOdPu/PTiQzDcmCPuRMPiBDf2BoFfwaT7h9dJfK8TZX5EHoQpqEtXW3vdIg51M62 wxcqM0MROnujqTap83KkCmHEWCpen74= X-MC-Unique: vBr3dikeMOaK_6MprS5tQQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] virsysinfo: Don't leak fw_cfg Date: Tue, 16 Jun 2020 13:38:56 +0200 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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 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" In v6.4.0-72-g3dda889a44 I've introduced parsing and formatting of new sysinfo type 'fwcfg'. However, I've forgot to introduce code that would free parsed data. Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza --- src/util/virsysinfo.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c index 52e576f129..db84339bda 100644 --- a/src/util/virsysinfo.c +++ b/src/util/virsysinfo.c @@ -131,6 +131,19 @@ void virSysinfoOEMStringsDefFree(virSysinfoOEMStringsD= efPtr def) VIR_FREE(def); } =20 + +static void +virSysinfoFWCfgDefClear(virSysinfoFWCfgDefPtr def) +{ + if (!def) + return; + + VIR_FREE(def->name); + VIR_FREE(def->value); + VIR_FREE(def->file); +} + + /** * virSysinfoDefFree: * @def: a sysinfo structure @@ -184,6 +197,10 @@ void virSysinfoDefFree(virSysinfoDefPtr def) =20 virSysinfoOEMStringsDefFree(def->oemStrings); =20 + for (i =3D 0; i < def->nfw_cfgs; i++) + virSysinfoFWCfgDefClear(&def->fw_cfgs[i]); + VIR_FREE(def->fw_cfgs); + VIR_FREE(def); } =20 --=20 2.26.2