Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp61342ybm; Tue, 21 May 2019 22:36:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqzPkeJXI/jLc7mZyfwkugTEM9vusqJqJndLoeqG1IWx+MK8N8R/IuYo5YS5SzSIe59y9393 X-Received: by 2002:a63:ce54:: with SMTP id r20mr89337544pgi.37.1558503387282; Tue, 21 May 2019 22:36:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558503387; cv=none; d=google.com; s=arc-20160816; b=VRdNhuxu47ekit/LyBtcaeylbCPGNrvP+BLjy17IZY9Xuv1bGQVp0RqwTkigVEhYeA Z3Z/uhch91MzpA6e3tjzfopRDuW48sjLsslSMbrthl9NyNiKiomwVo2oksmvq7UZ+/u5 mFNVj6saC3Z/3iJ7pI/blsxF+n4PRCVeeoPYYXmCkUiuSRVs1p09tP0PVt4FRB6WnZRa oNch77e0kVkZq+wmtyCSjDf4UH8EnkqLsVJiyPHg69Khz2PbK/t/ecB9XbDV4lEt2v33 nwRzHY6Nz8Y/vx1JUN71sdiw77rUhNhG+eyR8Ec6PPDK/yau7ILy107wE5xV6Xajoxhc 4tuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=aVdXzvqQIhIb7+Dl+JGEX8Rxb7ia/0nO7Krr3mIkGJw=; b=CZVH49cAdCWJfAmkpnV2Ic/oEtj0L/8/TXroXF2BUdXFSTuNL51G1/oNpPjMR0lO9K D8ieo3zd+3C2mhLB1VObaTTAtycfJNT+UehI0u3V2vs6Bbjq43K8Q/FnX9/JAXXNBBFF RUkJAcOCD7P87rXHcKYBcPYqtWqG09s7SmFdb4a3ZhNnSGEBss+UR170/5qmi7KZSJhS NQ9VB3iIsaFNscTHv8Xkczz/WZX33ZiI3sK1EKko2dLiskB8UmEtGAOIZwNa8mEXA7A8 XawTcy54wuyZXkIpAWAsl95wjhvfro/6cr6lsx7BvKkKO6VfEQx3r77JlPBETuSF7HaN 7pqw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o61si25534814pld.66.2019.05.21.22.36.12; Tue, 21 May 2019 22:36:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725850AbfEVFdu (ORCPT + 99 others); Wed, 22 May 2019 01:33:50 -0400 Received: from mga05.intel.com ([192.55.52.43]:63614 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725801AbfEVFdt (ORCPT ); Wed, 22 May 2019 01:33:49 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 May 2019 22:33:49 -0700 X-ExtLoop1: 1 Received: from ingas-nuc1.sea.intel.com ([10.254.190.110]) by orsmga007.jf.intel.com with ESMTP; 21 May 2019 22:33:48 -0700 From: Inga Stotland To: linux-bluetooth@vger.kernel.org Cc: brian.gix@intel.com, johan.hedberg@gmail.com, luiz.dentz@gmail.com, Inga Stotland Subject: [PATCH BlueZ 1/2] mesh: Unreference pending D-Bus messages Date: Tue, 21 May 2019 22:33:38 -0700 Message-Id: <20190522053339.6289-2-inga.stotland@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190522053339.6289-1-inga.stotland@intel.com> References: <20190522053339.6289-1-inga.stotland@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This change results in proper cleanup of D-Bus messages for pending replies: if l_dbus_message_ref() was called for a message, then l_dbus_message_unref() must be called for the same message to completely free the message resources. --- mesh/mesh.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mesh/mesh.c b/mesh/mesh.c index 231a6bca4..bed8484f2 100644 --- a/mesh/mesh.c +++ b/mesh/mesh.c @@ -354,6 +354,9 @@ static void free_pending_join_call(bool failed) mesh_agent_remove(join_pending->agent); + if (join_pending->msg) + l_dbus_message_unref(join_pending->msg); + if (failed) node_remove(join_pending->node); @@ -422,9 +425,6 @@ static void prov_disc_cb(struct l_dbus *bus, void *user_data) if (!join_pending) return; - if (join_pending->msg) - l_dbus_message_unref(join_pending->msg); - acceptor_cancel(&mesh); join_pending->disc_watch = 0; @@ -650,6 +650,7 @@ static void attach_ready_cb(void *user_data, int status, struct mesh_node *node) done: l_dbus_send(dbus_get_bus(), reply); + l_dbus_message_unref(pending_msg); l_queue_remove(pending_queue, pending_msg); } @@ -727,6 +728,7 @@ static void create_network_ready_cb(void *user_data, int status, done: l_dbus_send(dbus_get_bus(), reply); + l_dbus_message_unref(pending_msg); l_queue_remove(pending_queue, pending_msg); } -- 2.21.0