From nobody Mon May 6 14:15:37 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=1600869438; cv=none; d=zohomail.com; s=zohoarc; b=Cw5KXsmobYPdjtiFAx+s8EvYrdrl7xV3E8WsXg7ry4VVk9MkTtGGoSVT6QgqvGwPnI4wGmpuUjH63d/1dRcdeOdBSf6Xi5NzTOgQiq/GAEfsLzPvpn8fWNBJRU8aEU4DaV5p0BXrNaedKSMF5bQSckEOMHV61911ffYv5h92JUQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600869438; 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=zBd4rJqLW1XRub2IVa4ZjM+a37yGENHlJCaPXdHBM70=; b=KKqJvNUaiZBLSL3rS+fW+f0CtfDSOoei4QlSD0Sx0XNTpbEaldCC4OOMQ0uziSN6eV0az0ErvcsJOi6HTptho7CarxQPITpORbCtIH4pqeeNUFbafXEsv4mXu/HLljiiGq+LorQtIMwYmdvlNRcgwzjGTZw2pSX7WxH9BjbLUbM= 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 1600869438916611.9626071309292; Wed, 23 Sep 2020 06:57:18 -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-505-Juyuv7soNzKcsADS50JojA-1; Wed, 23 Sep 2020 09:57: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 85E981868417; Wed, 23 Sep 2020 13:57:09 +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 F3FE06115F; Wed, 23 Sep 2020 13:57:08 +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 6E0D0183D040; Wed, 23 Sep 2020 13:57:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08NDv42v016414 for ; Wed, 23 Sep 2020 09:57:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id A7F6660C15; Wed, 23 Sep 2020 13:57:04 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.192.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 246A560C04 for ; Wed, 23 Sep 2020 13:57:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600869437; 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=zBd4rJqLW1XRub2IVa4ZjM+a37yGENHlJCaPXdHBM70=; b=UEyCmXvnSbu47ILpXGEbfa1aAYKvhE4340KSpQLRg1eK7FVgLYB4s+5AS8lmAorDhK353F NKdQsYB6iBdth1kWJu41SUo/vEvK8+5mNiUstiex6w/2CnNUbpQg+JI38qEuZnjgAxfqrb cq+vtzNoOdg2i9cnsXzKBEYbRhfBVqs= X-MC-Unique: Juyuv7soNzKcsADS50JojA-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH] util/virgdbus: fix memory leak in virGDBusIsServiceInList Date: Wed, 23 Sep 2020 15:57:00 +0200 Message-Id: <1721133780306bcf8590cfaf064bdff7b18a2b30.1600869412.git.phrdina@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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 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" g_variant_iter_loop() handles freeing all arguments unless we break out of the loop, in that case we have to free them manually. Reported-by: Peter Krempa Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/util/virgdbus.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/virgdbus.c b/src/util/virgdbus.c index cd9ca8d5d6..4360a6acff 100644 --- a/src/util/virgdbus.c +++ b/src/util/virgdbus.c @@ -359,8 +359,10 @@ virGDBusIsServiceInList(const char *listMethod, =20 g_variant_get(reply, "(as)", &iter); while (g_variant_iter_loop(iter, "s", &str)) { - if (STREQ(str, name)) + if (STREQ(str, name)) { + g_free(str); return 0; + } } =20 return -2; --=20 2.26.2