From nobody Sun Apr 28 05:18:11 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=1592309258; cv=none; d=zohomail.com; s=zohoarc; b=esjE6521lZ8GmIzv+AGWBBr2RGP5gcS+357nLyM8+0p+vIiF5XHbsX1nZ7Vugoh5u7qlUOqS4hlCv3DPhlQLLSczmYOD3t91Pnkt/exy0i9Kbwa+FLyivsaQj4ctxY0g/CirhMDJLYlHwZ7rwl4J7NpF7/qbafgcvqW14Y4bZF8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592309258; 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=CxdkP9wglXnxBcnI0TQJOnYxtutIMAReyhLaJsO41YM=; b=AJZxTQbIHD83hYvoOk+lsnm1hdanH1R263sOFdDI/11I2r+hGX5UYzqLEGP8RFrohJZ3SaFA5EO2GPEV7p4b1o+SU4QAzha/UcGkJR/J+iQfW63JDvuLeosJBu+E61AkbwNB/jdVTK8sTtgCWNL0XCMvmSaFSC/NpTxg35iMY2c= 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 1592309258984816.307269472468; Tue, 16 Jun 2020 05:07:38 -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-159-X5skAjQyPQyHOwPlMav16A-1; Tue, 16 Jun 2020 08:07:35 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6D539E91C; Tue, 16 Jun 2020 12:07:27 +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 3CB021001B07; Tue, 16 Jun 2020 12:07:27 +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 EE3CB1809563; Tue, 16 Jun 2020 12:07:26 +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 05GC7GXi001095 for ; Tue, 16 Jun 2020 08:07:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3EAFB5D9DA; Tue, 16 Jun 2020 12:07:16 +0000 (UTC) Received: from unknown0050b6a41c42.attlocal.com (ovpn-112-147.phx2.redhat.com [10.3.112.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id F3A2B5D9D5 for ; Tue, 16 Jun 2020 12:07:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592309257; 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=CxdkP9wglXnxBcnI0TQJOnYxtutIMAReyhLaJsO41YM=; b=fV7j5s3uqjC0ch4d3GpA3XL02+0gqAMRQ0a3OBIoz5DttRfOishodTR+5/1NBD6qzfzqFp rb1TUOGr90+e64gRH404DrrT7m3NvCYLgSGcOo0bnXIiS3fhpTDuw6mCHhD3CWny19dhcB 1B3laaV2xC0g3snWBkl9WhzlzzEZeBs= X-MC-Unique: X5skAjQyPQyHOwPlMav16A-1 From: John Ferlan To: libvir-list@redhat.com Subject: [PATCH 1/9] util: Fix memory leak in virAuthGetCredential Date: Tue, 16 Jun 2020 08:07:02 -0400 Message-Id: <20200616120710.2628344-2-jferlan@redhat.com> In-Reply-To: <20200616120710.2628344-1-jferlan@redhat.com> References: <20200616120710.2628344-1-jferlan@redhat.com> 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.84 on 10.5.11.22 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" Since 5084091a, @tmp is filled by a g_key_file_get_string which is now an allocated string as opposed to some hash table lookup value, so we need to treat it as so. Found by Coverity Signed-off-by: John Ferlan Reviewed-by: Peter Krempa --- src/remote/remote_driver.c | 2 +- src/util/virauth.c | 5 +---- src/util/virauthconfig.c | 2 +- src/util/virauthconfig.h | 2 +- tests/virauthconfigtest.c | 2 +- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 0aeab9db27..653c68472a 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -4097,7 +4097,7 @@ static int remoteAuthFillFromConfig(virConnectPtr con= n, } =20 for (ninteract =3D 0; state->interact[ninteract].id !=3D 0; ninteract+= +) { - const char *value =3D NULL; + char *value =3D NULL; =20 switch (state->interact[ninteract].id) { case SASL_CB_USER: diff --git a/src/util/virauth.c b/src/util/virauth.c index f75e674586..105fca16eb 100644 --- a/src/util/virauth.c +++ b/src/util/virauth.c @@ -107,7 +107,6 @@ virAuthGetCredential(const char *servicename, char **value) { g_autoptr(virAuthConfig) config =3D NULL; - const char *tmp; =20 *value =3D NULL; =20 @@ -121,11 +120,9 @@ virAuthGetCredential(const char *servicename, servicename, hostname, credname, - &tmp) < 0) + value) < 0) return -1; =20 - *value =3D g_strdup(tmp); - return 0; } =20 diff --git a/src/util/virauthconfig.c b/src/util/virauthconfig.c index 1c007757c7..8289b28d34 100644 --- a/src/util/virauthconfig.c +++ b/src/util/virauthconfig.c @@ -99,7 +99,7 @@ int virAuthConfigLookup(virAuthConfigPtr auth, const char *service, const char *hostname, const char *credname, - const char **value) + char **value) { g_autofree char *authgroup =3D NULL; g_autofree char *credgroup =3D NULL; diff --git a/src/util/virauthconfig.h b/src/util/virauthconfig.h index de28b1ff28..b6f5b5c110 100644 --- a/src/util/virauthconfig.h +++ b/src/util/virauthconfig.h @@ -37,6 +37,6 @@ int virAuthConfigLookup(virAuthConfigPtr auth, const char *service, const char *hostname, const char *credname, - const char **value); + char **value); =20 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virAuthConfig, virAuthConfigFree); diff --git a/tests/virauthconfigtest.c b/tests/virauthconfigtest.c index 20855f004e..a88b453543 100644 --- a/tests/virauthconfigtest.c +++ b/tests/virauthconfigtest.c @@ -42,7 +42,7 @@ struct ConfigLookupData { static int testAuthLookup(const void *args) { const struct ConfigLookupData *data =3D args; - const char *actual =3D NULL; + g_autofree char *actual =3D NULL; int rv; =20 rv =3D virAuthConfigLookup(data->config, --=20 2.25.4 From nobody Sun Apr 28 05:18:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; 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 207.211.31.81 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=1592309248; cv=none; d=zohomail.com; s=zohoarc; b=OrQd5lxiomeIClt48oWY+MQBemadSnL1sN50m5T6jh5rc3z4tCzpzbIauTmf2kKsks/q5/HFJwEV4bh+nzpSJaIo5aN4yVNfoVytOl74xlcOxW6nFucOlt2FWLVZMe6OkwssKmmLNvexFpKMCvW3qyDftgxG35wba/9lr+KDiZE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592309248; 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=+rkkeZZKWfeOBaGEsW2fjgraFbECdNig/HPGf1rqIZI=; b=FJgpCMfurAReluR3Bg6jKEI23RLVBLSgdDJkylTVTqqAeJ016H/AfhZ5+Ha5nikNqGrwml/8p2lXzDvuMYkSpWaF5/majp5HXKrbFPObobgfmUZT1NjPiZ1InyZIiD5vFC5crnHfUmXpTXrVuKkuQ0SO8UQHmKZvYZ/KKoLxXh4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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 [207.211.31.81]) by mx.zohomail.com with SMTPS id 1592309248820107.53858655699833; Tue, 16 Jun 2020 05:07:28 -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-167-cTVzLKfoMr20mEHvYxJOow-1; Tue, 16 Jun 2020 08:07:25 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 073D8803316; Tue, 16 Jun 2020 12:07:19 +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 9208B100164C; Tue, 16 Jun 2020 12:07:18 +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 3004087422; Tue, 16 Jun 2020 12:07:17 +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 05GC7GYh001100 for ; Tue, 16 Jun 2020 08:07:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id A52665D9DA; Tue, 16 Jun 2020 12:07:16 +0000 (UTC) Received: from unknown0050b6a41c42.attlocal.com (ovpn-112-147.phx2.redhat.com [10.3.112.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id 65F365D9D5 for ; Tue, 16 Jun 2020 12:07:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592309247; 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=+rkkeZZKWfeOBaGEsW2fjgraFbECdNig/HPGf1rqIZI=; b=JM955TjVZNR+06yYEg2dRJV/1pP2Ad8dAOfrfWhqVqRYjyDoe+TKrER/x+XFTdkqS0o/c8 e4N814ZLL4nGP+trx1/oF8OWEG1/x7K0vMDxx1iVnrWH1/ZXeLexACh9PAJilKcBTGJIkp UiV/uNRZtEBVnFaiDHpxMvC9JnfJAyo= X-MC-Unique: cTVzLKfoMr20mEHvYxJOow-1 From: John Ferlan To: libvir-list@redhat.com Subject: [PATCH 2/9] util: Fix memory leak in virAuthConfigLookup Date: Tue, 16 Jun 2020 08:07:03 -0400 Message-Id: <20200616120710.2628344-3-jferlan@redhat.com> In-Reply-To: <20200616120710.2628344-1-jferlan@redhat.com> References: <20200616120710.2628344-1-jferlan@redhat.com> 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.84 on 10.5.11.22 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" Since 5084091a, @authcred is filled by a g_key_file_get_string which is now an allocated string as opposed to some hash table lookup value, so we need to treat it as so. Found by Coverity Signed-off-by: John Ferlan Reviewed-by: Peter Krempa --- src/util/virauthconfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virauthconfig.c b/src/util/virauthconfig.c index 8289b28d34..2e50609531 100644 --- a/src/util/virauthconfig.c +++ b/src/util/virauthconfig.c @@ -103,7 +103,7 @@ int virAuthConfigLookup(virAuthConfigPtr auth, { g_autofree char *authgroup =3D NULL; g_autofree char *credgroup =3D NULL; - const char *authcred; + g_autofree char *authcred =3D NULL; =20 *value =3D NULL; =20 --=20 2.25.4 From nobody Sun Apr 28 05:18:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; 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 207.211.31.81 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=1592309317; cv=none; d=zohomail.com; s=zohoarc; b=WAwqjrs/B6sahGBomQROB320ajHNGNPq7z8JMk89pS1LHCOcJd1+XARTPLDyNB0GF17/ms6GnDT/OI2QUdLiDOxOAJTOCccPx+lu58Az77/0P59A814eszEgmBph1XdAU8WZJmxY25QnbZX0bSbTwZRbK28MihA5xvzrKSAsWpI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592309317; 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=HhRo7DzMySAvORyhu2xEAnf2gefgU27yfxROoL8zM1M=; b=YERbUQ5DKGznz0ByG4flGR8LqT+0LSUnVuKTCcr66dU57/5Qe0uuHaBAoBu+T060wRSFv/zSmFpDza6WmU7oP5MxwWvqKCblgK2dYFHAUbaoDBQrTMfBRa7jUQOHNvfSxIDxwNjG6zefqHrkG1Qpk3vZK28l49Vv1YIVbgQaY5Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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 [207.211.31.81]) by mx.zohomail.com with SMTPS id 1592309317408268.66516143260696; Tue, 16 Jun 2020 05:08:37 -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-71-97VUY6a7MzSjB0FH5mfmyg-1; Tue, 16 Jun 2020 08:07:35 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BDED5E91B; Tue, 16 Jun 2020 12:07:26 +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 8F72719C79; Tue, 16 Jun 2020 12:07:26 +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 4AB6287425; Tue, 16 Jun 2020 12:07:26 +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 05GC7HnY001110 for ; Tue, 16 Jun 2020 08:07:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 184445D9DA; Tue, 16 Jun 2020 12:07:17 +0000 (UTC) Received: from unknown0050b6a41c42.attlocal.com (ovpn-112-147.phx2.redhat.com [10.3.112.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id CCE185D9D5 for ; Tue, 16 Jun 2020 12:07:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592309316; 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=HhRo7DzMySAvORyhu2xEAnf2gefgU27yfxROoL8zM1M=; b=hw/p5AhjAPUnLcZvcTUjcwV2GeuQL+IjGoxNA5L8LrV4mBjoE6HYx6v4gH3Kb6DqMTY2HQ B+4owPPlDBItDunBo3yshxWdsbQen1k4XCqLxTqSxFfAKr5YxxX46Dch35GjHvw9xXEtT9 ypx7/HSh6iGumX1buQK4GbBLBckq2c0= X-MC-Unique: 97VUY6a7MzSjB0FH5mfmyg-1 From: John Ferlan To: libvir-list@redhat.com Subject: [PATCH 3/9] lxc: Fix memory leak in virLXCControllerPopulateDevices Date: Tue, 16 Jun 2020 08:07:04 -0400 Message-Id: <20200616120710.2628344-4-jferlan@redhat.com> In-Reply-To: <20200616120710.2628344-1-jferlan@redhat.com> References: <20200616120710.2628344-1-jferlan@redhat.com> 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.84 on 10.5.11.23 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" Since 5b82f7f3, @path should have been placed inside the for loop since it'd need to be free'd for each pass through the loop; otherwise, we'd leak like a sieve. Found by Coverity. Signed-off-by: John Ferlan Reviewed-by: Peter Krempa --- src/lxc/lxc_controller.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 4672920574..734ac73210 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -1474,7 +1474,6 @@ static int virLXCControllerSetupDev(virLXCControllerP= tr ctrl) static int virLXCControllerPopulateDevices(virLXCControllerPtr ctrl) { size_t i; - g_autofree char *path =3D NULL; const struct { int maj; int min; @@ -1494,6 +1493,8 @@ static int virLXCControllerPopulateDevices(virLXCCont= rollerPtr ctrl) =20 /* Populate /dev/ with a few important bits */ for (i =3D 0; i < G_N_ELEMENTS(devs); i++) { + g_autofree char *path =3D NULL; + path =3D g_strdup_printf("/%s/%s.dev/%s", LXC_STATE_DIR, ctrl->def= ->name, devs[i].path); =20 --=20 2.25.4 From nobody Sun Apr 28 05:18:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; 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 207.211.31.81 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=1592309250; cv=none; d=zohomail.com; s=zohoarc; b=GzZo2/biBoujt91XgrXDPyCdB4ogLSbczBq97xKEJ1GGiGkFIHQ3YJMCM2iOOpf/jp4dcex6GgXnOFFamdhFRKc+8FoVfOMA7nnoJC5BwjyBHUqjHZTbCkhbvjxfuEwnErZFUg7I/mV3E4xqaHGZiIp75Lx3yQklgAPeorNL34s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592309250; 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=W7mrsaqRvKrAtkU7NRdXjBDNYu7pW7phZW7U4ZuexEI=; b=WnwzXOnrfQh7XnEE9OBpS0e8Jksgj1fToJs/NImyP+f0aXBXBRf9DiP8gCyKo2mmv5APh6miZmSHeC/QZ0rgaednpyuOur+VXVIr5dHXxlm3/LnUkoBOimIYsa/gKFvy8zuR9xW5xuDJyDkP7S2n+f8qgeyI3cvavn+qpNjFeaY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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 [207.211.31.81]) by mx.zohomail.com with SMTPS id 1592309250262137.70938765011192; Tue, 16 Jun 2020 05:07:30 -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-447-LvsIKDRZM6aRf-553MNB8w-1; Tue, 16 Jun 2020 08:07:26 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BD92610082EB; Tue, 16 Jun 2020 12:07:20 +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 904EA5D9DD; Tue, 16 Jun 2020 12:07: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 41D871809554; Tue, 16 Jun 2020 12:07:20 +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 05GC7HIV001119 for ; Tue, 16 Jun 2020 08:07:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7E0395D9DA; Tue, 16 Jun 2020 12:07:17 +0000 (UTC) Received: from unknown0050b6a41c42.attlocal.com (ovpn-112-147.phx2.redhat.com [10.3.112.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F7F25D9D5 for ; Tue, 16 Jun 2020 12:07:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592309248; 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=W7mrsaqRvKrAtkU7NRdXjBDNYu7pW7phZW7U4ZuexEI=; b=VNk0J9hvsPEIYabIc+pBg4wt7vb6Z1nIZIYtmMmFlhmbaeFxgVhaLpnNiQ/zAH90zspns6 b23oYWmcKEq5seeM06qsxrcbJjFarQJ7MzmTYvAEi0YYr7uC8GAsnaIpaPO5ATVWrgOYZJ le9jsijgGIan79IqwajpkaxjOKsJ+cQ= X-MC-Unique: LvsIKDRZM6aRf-553MNB8w-1 From: John Ferlan To: libvir-list@redhat.com Subject: [PATCH 4/9] util: Fix memory leak in virPCIProbeStubDriver Date: Tue, 16 Jun 2020 08:07:05 -0400 Message-Id: <20200616120710.2628344-5-jferlan@redhat.com> In-Reply-To: <20200616120710.2628344-1-jferlan@redhat.com> References: <20200616120710.2628344-1-jferlan@redhat.com> 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.14 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" Since 9ea90206, @drvpath could be overwritten if we jumped to recheck Found by Coverity. Signed-off-by: John Ferlan Reviewed-by: Peter Krempa --- src/util/virpci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util/virpci.c b/src/util/virpci.c index 6c7e6bbcab..16936c4be9 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -1018,6 +1018,7 @@ virPCIProbeStubDriver(virPCIStubDriver driver) goto cleanup; } =20 + g_free(drvpath); goto recheck; } =20 --=20 2.25.4 From nobody Sun Apr 28 05:18:11 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=1592309258; cv=none; d=zohomail.com; s=zohoarc; b=Zglb6ZiCh+JQc7laqPh2MDY2bMBGTXTxjZaM7RLZHME/vj3XnvlrvPdaCGySQgzULG81ySBnDMBI/hYAkon3sscuoXl2czBFUwxYvmdAjB5qFi0dOLlA++lxqzDvAb0ccps/t0MLQh+tGxjmQH/SLre5D6hC06scwKPQz+3MSP4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592309258; 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=TccH1N4MInVnBy/VUJ6MSQ3QDoHGQHiw1qSL/WQQoRs=; b=bbRYm//v1cbbNKSjPjdjYLF029ffSvS5oozdZso11pvCKGTFhP9nugvOruud9KRqdvfECxlwUsAa5ft3s+iJefix+nxoYJWuJk2z4YLZ/mZ2Zxx/88c6l0M1ldmrqk/1trgDXyw64nIiL1V4uuW/wbSLZ1l0V8OeeX0BhRfJ56M= 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 1592309258364892.0245674366454; Tue, 16 Jun 2020 05:07:38 -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-148-LmONZ775O7CCDobGVYnDvQ-1; Tue, 16 Jun 2020 08:07:34 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 28F5D84B8A4; Tue, 16 Jun 2020 12:07:27 +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 F25C05D9E4; Tue, 16 Jun 2020 12:07:26 +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 B6CD987428; Tue, 16 Jun 2020 12:07:26 +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 05GC7Hsg001129 for ; Tue, 16 Jun 2020 08:07:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id E56A35D9DA; Tue, 16 Jun 2020 12:07:17 +0000 (UTC) Received: from unknown0050b6a41c42.attlocal.com (ovpn-112-147.phx2.redhat.com [10.3.112.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id A64E45D9D5 for ; Tue, 16 Jun 2020 12:07:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592309256; 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=TccH1N4MInVnBy/VUJ6MSQ3QDoHGQHiw1qSL/WQQoRs=; b=i/Cu7y9DFlEX6xMP8LVLeLI5SBMIGIHy0uEByYgjVdL55PBPNwTiLBj9hwjx0LQeHnD4gq PYbHjGF3VMWLwHbOxTLi9wJWDo8BKFtcdxChndTddRtD5aqyyFR3K2xYzHq62noiEyXbOz YpNO24Gu4HqStodK7JHfE+vnFUbDaYA= X-MC-Unique: LmONZ775O7CCDobGVYnDvQ-1 From: John Ferlan To: libvir-list@redhat.com Subject: [PATCH 5/9] test: Fix memory leak in testParseXMLDocFromFile Date: Tue, 16 Jun 2020 08:07:06 -0400 Message-Id: <20200616120710.2628344-6-jferlan@redhat.com> In-Reply-To: <20200616120710.2628344-1-jferlan@redhat.com> References: <20200616120710.2628344-1-jferlan@redhat.com> 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.14 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" Since ceb3255c, @absFile could be leaked if we jumped to error. Found by Coverity. Signed-off-by: John Ferlan Reviewed-by: Peter Krempa --- src/test/test_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 7a1db21718..993f405f3c 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -781,7 +781,7 @@ testParseXMLDocFromFile(xmlNodePtr node, const char *fi= le, const char *type) { xmlNodePtr ret =3D NULL; xmlDocPtr doc =3D NULL; - char *absFile =3D NULL; + g_autofree char *absFile =3D NULL; g_autofree char *relFile =3D NULL; =20 if ((relFile =3D virXMLPropString(node, "file"))) { --=20 2.25.4 From nobody Sun Apr 28 05:18:11 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=1592309263; cv=none; d=zohomail.com; s=zohoarc; b=ClEqGo0o1j3v7S56XjLOhKwX9NJw+Lm9yQHDCx/nNOIarit1S6oepuTbwRS+GEW8JabOTGucIzoAEbl6rob9jB7zZtFlahdsBGGvMWtzAdDxO6APXGGcpYwepMn1oKcMgtemd/alotEX7QTqld5zt7mynqSCmCijAI9ukaBUgdY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592309263; 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=A8oDm0hgfj0008bCSGzj42fyjRf5x3ZHde05cDOR0kQ=; b=YOAU/DCngAfb99bgBHMBz21W6SY4unbEd06oMS+3KJ+5xt/AP7UNolKMu0vug2RdtTpCkZBbE5mLPhuKNRZfvk/T44QFclOa7RHoYs4TfvO/homzHT5Ggm1U1pXytDbG+DwZKAehoscrQRj7uPzE/qsd39+4rgVK5ULZuBHj+zU= 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 1592309263450489.25011726876903; Tue, 16 Jun 2020 05:07:43 -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-207-L74vFkkWOQmFh9b5CRl9OA-1; Tue, 16 Jun 2020 08:07:38 -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 C63A3106B247; Tue, 16 Jun 2020 12:07:30 +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 9115D7930C; Tue, 16 Jun 2020 12:07:30 +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 3C29E1806B0B; Tue, 16 Jun 2020 12:07:30 +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 05GC7IrV001136 for ; Tue, 16 Jun 2020 08:07:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 571A75D9DA; Tue, 16 Jun 2020 12:07:18 +0000 (UTC) Received: from unknown0050b6a41c42.attlocal.com (ovpn-112-147.phx2.redhat.com [10.3.112.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id 187B95D9D5 for ; Tue, 16 Jun 2020 12:07:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592309262; 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=A8oDm0hgfj0008bCSGzj42fyjRf5x3ZHde05cDOR0kQ=; b=WV4sYS+J9MJp3V0NJGZn04DZ/rqfO65dz2uIM1XlNOeAkB8XlGTbgGbmsgzwX+LO+COPJZ ncws6IsOb9OZjUy11Cj7IMinVtbmtfNxX49XRLFoElDFLpA94kjN7KLpo3NdyIRYCEUpFE qNwH3nTmC6BPDp/Rx5ZZdf53b7xozKs= X-MC-Unique: L74vFkkWOQmFh9b5CRl9OA-1 From: John Ferlan To: libvir-list@redhat.com Subject: [PATCH 6/9] conf: Fix memory leak in openvzWriteConfigParam Date: Tue, 16 Jun 2020 08:07:07 -0400 Message-Id: <20200616120710.2628344-7-jferlan@redhat.com> In-Reply-To: <20200616120710.2628344-1-jferlan@redhat.com> References: <20200616120710.2628344-1-jferlan@redhat.com> 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Since 60623a7c, @temp_file was not properly free'd on the non error path. Found by Coverity. Signed-off-by: John Ferlan Reviewed-by: Peter Krempa --- src/openvz/openvz_conf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index 78547b8b28..c06bfa13e3 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -616,7 +616,7 @@ int openvzLoadDomains(struct openvz_driver *driver) static int openvzWriteConfigParam(const char * conf_file, const char *param, const ch= ar *value) { - char * temp_file =3D NULL; + g_autofree char *temp_file =3D NULL; int temp_fd =3D -1; FILE *fp; char *line =3D NULL; @@ -666,7 +666,6 @@ openvzWriteConfigParam(const char * conf_file, const ch= ar *param, const char *va VIR_FORCE_CLOSE(temp_fd); if (temp_file) unlink(temp_file); - VIR_FREE(temp_file); return -1; } =20 --=20 2.25.4 From nobody Sun Apr 28 05:18:11 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=1592309261; cv=none; d=zohomail.com; s=zohoarc; b=O1QiAMJyVwYJaURoe2dDnTT52zvrQA/KGQnBbPaDBSAckGXoXpu8PzfunpMaBKFjFWBmkxx2CKVzm1tYPvmrinIKcjf/DNcxyBZgFpSLi8/j+Ep+TvS90m+gVwQsz4/UNtnw5QucH1nYCtbWshIMKFSjSN3rFh+2QKuYhzwM2uI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592309261; 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=cLx14MU5pjqTKJIqd0WGmJ3dU2BZmwz6AgmqSvgLLyc=; b=hgz3DINEYFshxkvp79sy4aJbva++7IQJmgRROMVg830A0kc3Xl6EtCs6+hUibRgZWLQL/Sv3UPd6XJ87ATxwdkH7HED6thhpAKxCvaQqhIt9p1mcFyM7YX49ytbmOPqpVtlsloMSW+fUP8qKCprD0w0Q7ZVz98vCWrfDM75kUtE= 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 1592309261809712.8525509631963; Tue, 16 Jun 2020 05:07:41 -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-134-ZqqSGDM_Ovy3oV_lj-CEnA-1; Tue, 16 Jun 2020 08:07:38 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DA203873014; Tue, 16 Jun 2020 12:07:29 +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 AA7DF100164C; Tue, 16 Jun 2020 12:07:29 +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 6744A1809547; Tue, 16 Jun 2020 12:07:29 +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 05GC7IeG001144 for ; Tue, 16 Jun 2020 08:07:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id BD9C45D9DA; Tue, 16 Jun 2020 12:07:18 +0000 (UTC) Received: from unknown0050b6a41c42.attlocal.com (ovpn-112-147.phx2.redhat.com [10.3.112.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7EA4A5D9D5 for ; Tue, 16 Jun 2020 12:07:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592309260; 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=cLx14MU5pjqTKJIqd0WGmJ3dU2BZmwz6AgmqSvgLLyc=; b=KHG/gMVsTprn3MXtwg52nKfw2F12mOZtTgyTjtHjQ1BNjiRDnCaMplgBjuKQwxZDV0xABg PfMLkcjR3t0LVS1NaVTtJyPbmwFWCsLIFekeszAqu8+Ko++c+WbJfxfntyt7ALtpeaMUSk uhPePjR/yd7cSt44vtZhEtXDHBTBxQA= X-MC-Unique: ZqqSGDM_Ovy3oV_lj-CEnA-1 From: John Ferlan To: libvir-list@redhat.com Subject: [PATCH 7/9] conf: Fix memory leak in openvzReadFSConf Date: Tue, 16 Jun 2020 08:07:08 -0400 Message-Id: <20200616120710.2628344-8-jferlan@redhat.com> In-Reply-To: <20200616120710.2628344-1-jferlan@redhat.com> References: <20200616120710.2628344-1-jferlan@redhat.com> 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.84 on 10.5.11.22 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" Since 1f5deed9, @veid_str has been leaked in the error path. Found by Coverity. Signed-off-by: John Ferlan Reviewed-by: Peter Krempa --- src/openvz/openvz_conf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index c06bfa13e3..190c57b622 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -330,7 +330,7 @@ openvzReadFSConf(virDomainDefPtr def, { int ret; virDomainFSDefPtr fs =3D NULL; - char *veid_str =3D NULL; + g_autofree char *veid_str =3D NULL; char *temp =3D NULL; const char *param; unsigned long long barrier, limit; @@ -365,8 +365,6 @@ openvzReadFSConf(virDomainDefPtr def, fs->type =3D VIR_DOMAIN_FS_TYPE_MOUNT; if (!(fs->src->path =3D virStringReplace(temp, "$VEID", veid_str))) goto error; - - VIR_FREE(veid_str); } =20 fs->dst =3D g_strdup("/"); --=20 2.25.4 From nobody Sun Apr 28 05:18:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; 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 207.211.31.81 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=1592309289; cv=none; d=zohomail.com; s=zohoarc; b=GBYX3/veQy1v1/6TuDNndtSYyvIp0Yx55NaYpm9R836/34IsbICoWfHMzI8Orx1+zaVlJNI8u5gJb7wZelA0bQB60ZTerDB2/dcTTnYeEZ1ECupXIT+sVwIq9fHNUAEwm/tloh7KeaV+FzgD1B7vxaKUsnOgNiG3YdRnlWQoSF4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592309289; 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=XEsBxZnK8kWDui33e3xM8ChWCW6J3H9JfPtm2WgP5/w=; b=WThxWeA+ZmQdJEyP4ygZl/V5EmrZLezl5GoW9hYzrqCzVFkQj0/vxz6tNTQ5KLrvY0ZW/vhTv0lyVM4BM3zpry9kXCCqxBNG5Inojgsmzoa9glWaFgXSba6wlpy8Bej3i1mpG7TpxmCicbJNq/TrDrrZPd5H1qwrdu/n6ELzhaQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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 [207.211.31.81]) by mx.zohomail.com with SMTPS id 1592309289712267.0407438655817; Tue, 16 Jun 2020 05:08:09 -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-253-jo9_-ertP8Wla4L6A7IH5Q-1; Tue, 16 Jun 2020 08:07:41 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 934A9E922; Tue, 16 Jun 2020 12:07:30 +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 62C6E5D9D5; Tue, 16 Jun 2020 12:07:30 +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 E66B5180BACF; Tue, 16 Jun 2020 12:07:29 +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 05GC7J9R001151 for ; Tue, 16 Jun 2020 08:07:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2FFEF5D9D5; Tue, 16 Jun 2020 12:07:19 +0000 (UTC) Received: from unknown0050b6a41c42.attlocal.com (ovpn-112-147.phx2.redhat.com [10.3.112.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id E52AA5D9DD for ; Tue, 16 Jun 2020 12:07:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592309288; 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=XEsBxZnK8kWDui33e3xM8ChWCW6J3H9JfPtm2WgP5/w=; b=RpjB1LVsCftl1de44viwQuC9oymjch0Nn+rXhhgE6wybyTD2GiotlnRFH8ruFVr335MmNz LgeoBpQqkdzrh1/EHL4Rgf+/ofFMVgzlko/n1y5SKl0yLUIPhn6SMi4Qarvyow7w6LNLCL TW2csa5Tzjy9s+1pG0woH/M6nZ6WMH8= X-MC-Unique: jo9_-ertP8Wla4L6A7IH5Q-1 From: John Ferlan To: libvir-list@redhat.com Subject: [PATCH 8/9] conf: Fix memory leak in virCPUDefParseXML Date: Tue, 16 Jun 2020 08:07:09 -0400 Message-Id: <20200616120710.2628344-9-jferlan@redhat.com> In-Reply-To: <20200616120710.2628344-1-jferlan@redhat.com> References: <20200616120710.2628344-1-jferlan@redhat.com> 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.14 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" Since a08669c31, @tsc is not automatically free'd by any g_auto* method. Found by Coverity. Signed-off-by: John Ferlan Reviewed-by: Peter Krempa --- src/conf/cpu_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index b40737e407..e1b0a5653f 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -335,7 +335,7 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt, g_autofree char *vendor_id =3D NULL; g_autofree char *tscScaling =3D NULL; g_autofree char *migratable =3D NULL; - virHostCPUTscInfoPtr tsc =3D NULL; + g_autofree virHostCPUTscInfoPtr tsc =3D NULL; =20 *cpu =3D NULL; =20 --=20 2.25.4 From nobody Sun Apr 28 05:18:11 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=1592309289; cv=none; d=zohomail.com; s=zohoarc; b=nPpcQAuIMNykjp8nlGNwSfTPfm0PmqnVCwFFw2Vz/1hifBL1tdvbGj24VXGF5G5aJvp3rv2qEz53PxMruf33pSXAlZ/UC9+k6PrT3zlLtml6Ke42+9jhQpjxWbS9RHfOahKSNC+8eGA5szQrRbrj6OM6c0znEH44MChyBRzo9r0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592309289; 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=DhvBvdEBQUPLTM0mddRTAuAmkHwfXmcVb3cnAEAi5zc=; b=GEdNeVuRC1Y5hKB1t6WU0O0YTyA7cbBbeTtSVPY035CgBLHW2MJ64WNd53kt3iGwQxVFLhTpW9swiQPU2DOc2Ja7i7I1XooUQ+aATcMHht0/bfFvIm4/as4bo+MhZ16wZwXke9GPvP9mZnYszeh/rZOnWHbJtpjbyQoM4vr3DLs= 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 1592309289700381.77598966626795; Tue, 16 Jun 2020 05:08:09 -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-77-wrI-RZ8WOtO_nCHKCY_g2Q-1; Tue, 16 Jun 2020 08:07:44 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5F0B3100A623; Tue, 16 Jun 2020 12:07:37 +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 3991A7FE95; Tue, 16 Jun 2020 12:07: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 E792787425; Tue, 16 Jun 2020 12:07:36 +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 05GC7JrB001156 for ; Tue, 16 Jun 2020 08:07:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 96E635D9DA; Tue, 16 Jun 2020 12:07:19 +0000 (UTC) Received: from unknown0050b6a41c42.attlocal.com (ovpn-112-147.phx2.redhat.com [10.3.112.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id 57F905D9D5 for ; Tue, 16 Jun 2020 12:07:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592309288; 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=DhvBvdEBQUPLTM0mddRTAuAmkHwfXmcVb3cnAEAi5zc=; b=fVBrz89h7N0bl+PJ7AIZTFZqqiek15jhXcnPVMZH7YqYCrzWmJJrIZeKQAE6HWCJrGzPpr EBV5GuBDwHlH9X1mDTYj1UTyIhA99JYEOJBmc6xC/VTXsDX6nn2mgSHv85yr9n2J8QlvwR DKb3BEQjKp2WB0TK+jdIwGW5wtyQv88= X-MC-Unique: wrI-RZ8WOtO_nCHKCY_g2Q-1 From: John Ferlan To: libvir-list@redhat.com Subject: [PATCH 9/9] util: Avoid using wrong free function Date: Tue, 16 Jun 2020 08:07:10 -0400 Message-Id: <20200616120710.2628344-10-jferlan@redhat.com> In-Reply-To: <20200616120710.2628344-1-jferlan@redhat.com> References: <20200616120710.2628344-1-jferlan@redhat.com> 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.15 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" Since 1e2ae2e31, changes to use the automagic free logic didn't take into account that one path uses posix_memalign and the other uses VIR_ALLOC_N - the former requires using VIR_FREE() and not g_free() to free the memory. Found by Coverity. Signed-off-by: John Ferlan Reviewed-by: Peter Krempa --- src/util/iohelper.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/util/iohelper.c b/src/util/iohelper.c index 342bae229b..64b7a13f61 100644 --- a/src/util/iohelper.c +++ b/src/util/iohelper.c @@ -45,7 +45,11 @@ static int runIO(const char *path, int fd, int oflags) { +#if HAVE_POSIX_MEMALIGN + void *base =3D NULL; /* Location to be freed */ +#else g_autofree void *base =3D NULL; /* Location to be freed */ +#endif char *buf =3D NULL; /* Aligned location within base */ size_t buflen =3D 1024*1024; intptr_t alignMask =3D 64*1024 - 1; @@ -168,6 +172,9 @@ runIO(const char *path, int fd, int oflags) ret =3D 0; =20 cleanup: +#if HAVE_POSIX_MEMALIGN + VIR_FREE(base); +#endif if (VIR_CLOSE(fd) < 0 && ret =3D=3D 0) { virReportSystemError(errno, _("Unable to close %s"), path); --=20 2.25.4