From nobody Mon May 20 02:35:11 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=1600871886; cv=none; d=zohomail.com; s=zohoarc; b=nNQt+KW8+/joJJOV9F12DtijAk6SCUAAYiZOyg6tfHgvmo1oDY3hXqVFhqg6RnrJucDCtBrLhgrdDbcL+GvCOKQVT2Y7zsofc4vYfcYtvKwum0z8qgnP6QO7JyqeCU9Mf/M1pYAmY3pRYshRtmXIjDXagRvdiS+9nftBoO9+MWI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600871886; 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=XU60q3axu1IdOscf/S9kPZ3VjrNo0GdbJ/1rE7LrmnI=; b=dveWKPP0SKCJhMLpiFQqolVegancOaP0dDzLw+03D6g28XXpFEBPxFwyAQEI8stDoVGo8AZ8i+VV6QwgUGt9Zf90E2unTB2n9NvndGJhFDgjxoA49qF1Sna0vGvefRumVyoP5WgkwMHZV/gxTO9A/PI30dFvFFKq4j9YNGQRgvA= 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 16008718864981017.0729351797168; Wed, 23 Sep 2020 07:38:06 -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-237-ruV-zVOlOEmvKWaIlGSrag-1; Wed, 23 Sep 2020 10:38:01 -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 13AAD1891E93; Wed, 23 Sep 2020 14:37:56 +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 AF1251001281; Wed, 23 Sep 2020 14:37:55 +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 F32BE8C7AC; Wed, 23 Sep 2020 14:37:53 +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 08NEbr7o022246 for ; Wed, 23 Sep 2020 10:37:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 174C878823; Wed, 23 Sep 2020 14:37:53 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.192.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47D6B78822 for ; Wed, 23 Sep 2020 14:37:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600871885; 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=XU60q3axu1IdOscf/S9kPZ3VjrNo0GdbJ/1rE7LrmnI=; b=bKxojZ25J9Eb1YjPVdn01c3FOL79hztSPC+ooMTFIIOLdd+sxB26udFZQ01FGLoQyEHEtY KYrBFtAUiuFvMqrQ2e4R4cZXgeYrFE25/8o35DVc+FAlL5bBLLRe7nFFOuNoOEf0DceP5/ +V0xDUVp5bq/fni9dIHBICxOM7lA9vM= X-MC-Unique: ruV-zVOlOEmvKWaIlGSrag-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH] virnetdaemon: fix memory leak in virNetDaemonCallInhibit Date: Wed, 23 Sep 2020 16:37:48 +0200 Message-Id: <22390d367ddc9665c17c4f5c308853514d63a135.1600871856.git.phrdina@redhat.com> 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.84 on 10.5.11.22 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_new() returns a weak reference which can be consumed by passing to other g_variant* functions or to g_dbus_connection_call* functions. This make it possible to call g_variant_new() directly as argument to the functions above. Because this might be confusing I explicitly call g_variant_ref_sink() to make it normal reference in both virGDBusCallMethod() and virGDBusCallMethodWithFD() so the caller is always responsible for the data. Reported-by: Peter Krempa Signed-off-by: Pavel Hrdina Reviewed-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- src/rpc/virnetdaemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpc/virnetdaemon.c b/src/rpc/virnetdaemon.c index f3a5e9f75c..2e01244f74 100644 --- a/src/rpc/virnetdaemon.c +++ b/src/rpc/virnetdaemon.c @@ -469,7 +469,7 @@ virNetDaemonCallInhibit(virNetDaemonPtr dmn, { g_autoptr(GVariant) reply =3D NULL; g_autoptr(GUnixFDList) replyFD =3D NULL; - GVariant *message =3D NULL; + g_autoptr(GVariant) message =3D NULL; GDBusConnection *systemBus; int fd; int rc; --=20 2.26.2