From nobody Fri Mar 29 10:18:02 2024 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=1589809280; cv=none; d=zohomail.com; s=zohoarc; b=VUYmODUnPTvGoKo649auDWA6UadzfwURBXqULMQZOa687ItHCZ2DBTqzAxzDDZFjro+qQr8y0U/3CDT+JRRejguOGh/rpexKIr70WTVm64dX2j9myWBN9vh+IZbAkmgDCBb+/KQs6JgkG8D0WsCWxCofC8YJfG9Kh/PHcUdRT5U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589809280; 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=/9qIyw6ca8bSZoOmTeaMxjGApJ4sxFRCtsuVixnlXY8=; b=YWfzYNvuBeIRBNkC/Gq4l+QavC5uIZrP9PEIL7aB41CjksiA/WbzPChEASKToyJEeme/EAo38P43qRIanr6JlQujL61qyxKXo3crkmG9rRMzmLZn5FbErjS3E/GZgEgWTCRdRD/yxjwY464FeO/wpQHxbeNc0ONhnfNBB3ZQnkA= 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-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1589809280608157.06024325562362; Mon, 18 May 2020 06:41:20 -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-160-e7N5NpWRNRS-DYSaMW1dNw-1; Mon, 18 May 2020 09:41:15 -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 209DF53; Mon, 18 May 2020 13:41:10 +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 F15457958F; Mon, 18 May 2020 13:41:09 +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 A37DD4ED59; Mon, 18 May 2020 13:41:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04IDf6hO014759 for ; Mon, 18 May 2020 09:41:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6CA595D9DC; Mon, 18 May 2020 13:41:06 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id D47D25D9DD for ; Mon, 18 May 2020 13:41:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589809279; 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=/9qIyw6ca8bSZoOmTeaMxjGApJ4sxFRCtsuVixnlXY8=; b=hVtD9kQgk3T4Zi1tmJ4Z5+HVVGWe+vn/SKrKkc049lGyjKfGQRB2JLIJ7KiljLg5fn5aaL GQMXcesjo30+2yonY1B2tq698w3g0HRDRQ00zAftmAbIA/saDSheFF/RR3ikVZIOZYjSfL 9L2+Qzd0axp0Mqsiv9JCgNntCEpFZKA= X-MC-Unique: e7N5NpWRNRS-DYSaMW1dNw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/2] qemu: do not leak the directory in virQEMUDriverConfigLoadMemoryEntry Date: Mon, 18 May 2020 15:40:55 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) virConfGetValueString returns an allocated string that needs to be freed. Fixes: 34a59fb570dcc1b6b4b4cef1f0eb43fc6f688120 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 2d5e527b47..2d4e2a46f3 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -969,7 +969,7 @@ static int virQEMUDriverConfigLoadMemoryEntry(virQEMUDriverConfigPtr cfg, virConfPtr conf) { - char *dir =3D NULL; + g_autofree char *dir =3D NULL; int rc; =20 if ((rc =3D virConfGetValueString(conf, "memory_backing_dir", &dir)) <= 0) { --=20 2.25.4 From nobody Fri Mar 29 10:18:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.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 205.139.110.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=1589809279; cv=none; d=zohomail.com; s=zohoarc; b=D78d8HoMAToOltlMa8o1avLH0zVnd0rmp/J91wVBpz8ZoUuB6Q5XMd48ria/7IA71+wguZNiSNARlXVp8Eab3wkxZD9vHgKQ9hGWaTjCySRr4wl1HIK782BNmlI5Po+238kpT1symA2+m9B44ROYuptYTydI/+ufASkE4e5RvC0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589809279; 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=TKe1ksHLvFTRUDNk8gp92cSh5wjSfHKFSfavyNEl0qw=; b=gnG2f2hJFkUADeImTgnyIBGzRM/6ug28bA9eSCMIYhDYyf6uin8/696xRzZTXKP2yZSToloRUmnEe7yAMBfDsDYF78zwLifYjz33djg/0ugNsE3ZaC3gHJdAue8B43OapgJz/Iqj9yLv+23yDNpjqcBl8qNFmda5mnWvOgDkNf8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.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 [205.139.110.120]) by mx.zohomail.com with SMTPS id 1589809279982364.05764609408607; Mon, 18 May 2020 06:41:19 -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-400-CXa0E0cGPv-11CSJEp9gyA-1; Mon, 18 May 2020 09:41:15 -0400 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 62DC1100CCC0; Mon, 18 May 2020 13:41:10 +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 40A406109F; Mon, 18 May 2020 13:41:10 +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 117114ED5B; Mon, 18 May 2020 13:41:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04IDf7cp014767 for ; Mon, 18 May 2020 09:41:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5AC885D9DD; Mon, 18 May 2020 13:41:07 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id CBAC85D9DC for ; Mon, 18 May 2020 13:41:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589809278; 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=TKe1ksHLvFTRUDNk8gp92cSh5wjSfHKFSfavyNEl0qw=; b=HodZlK+lucDW7W1TXgwhNe3fe4koLuYbzgpw/QR64UgeGsDvoow0jpgLOQ4bb1yPt0Wic4 7ksCX4CgLmgCoEHvl2SKIAZbwH+hklSQ6+txothmSqg18wXxa+sZMT3/l/Ki6eVgBz4+RQ LMJ4y9/XYhDjkLo4B3X0oH+tc0V8IMs= X-MC-Unique: CXa0E0cGPv-11CSJEp9gyA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/2] qemu: only return two values in virQEMUDriverConfigLoadMemoryEntry Date: Mon, 18 May 2020 15:40:56 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.12 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) The intention of these split Load*Entry functions is to prevent virQEMUDriverConfigLoadFile from getting too large. There's no need to signal to the caller whether an entry was found or not, only whether there was an error. Remove the non-standard return 1. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 2d4e2a46f3..b49299e1de 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -977,7 +977,7 @@ virQEMUDriverConfigLoadMemoryEntry(virQEMUDriverConfigP= tr cfg, } else if (rc > 0) { VIR_FREE(cfg->memoryBackingDir); cfg->memoryBackingDir =3D g_strdup_printf("%s/libvirt/qemu", dir); - return 1; + return 0; } =20 return 0; --=20 2.25.4