Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1857593ybk; Thu, 21 May 2020 17:35:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwl9oibFkKQfLxTKFvZ/tSRb1z6nAJ+0CexXgKEMmvwjmHP//GFgWQ6CDIIG3AjWDKORBJ4 X-Received: by 2002:a17:906:6891:: with SMTP id n17mr5769626ejr.338.1590107749941; Thu, 21 May 2020 17:35:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590107749; cv=none; d=google.com; s=arc-20160816; b=iVRwri1SiZhwnWckdWwINVNQv+va9LeXpdq1v8lP5FAy2GHyVLh2Knf2SfJnaySJHI FBhyQU/KUYPX5Udvl46NzS1WqKgzIglUDRMF1y1nAV6svuMguEx7afp3MwIefifeK8Ug hAOLyMnBrytqYgD/6uJ+TmLOjpLxIORP9c7DqvCeFRMGYr9SsaYHGOwm1bvuaq1xjIhN SlTb7aqWpvXrMnR9VFKTpzIB4MeyzRlMIWrS8azTxztijmVkBq9Zkheo2WcSMinzpnbx pdcwNFfCExedqqEDwBQqsjNnENVCNtfqoAcSQkOoXOHFbI2Jj6F1UsSxPzOsYVn5P0Fc ccjw== 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 :ironport-sdr:ironport-sdr; bh=VCgGbTUN+/mtQee9+vM+2t53y+6Iz89q6HmJAH9WLEI=; b=lfQtAcQCzgMMXqRYgt3itb1CC3h0EGGtasFJLKT4AXnqU+DxqAbLnvTKpNukkKcuAz r4S6LQAtyNKaQAyoUzp/bnPP7kholbYiid3q1fnXiCcKcJAawsluP/3EuKYui5leo1MV ULOwAZBe2D186LAckHtygBD8o4t9Y3QjDW8De3dLzi//5zdiGYxIwx+j6WzIPKCU5Ac7 GYjv5lVPj+u95PoJDxcWK6HlbbpVY44MzhYmGr5cWECuyVjKzxTFi0S0ZAFNmD/8S9RI ZA1LeBiNI682cmSIdOUubpVeDTk70NcslhjsIOnN3W2+I5nGfxw/doDjtreX0ljxx0Pl cv/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id p19si4073889ejf.233.2020.05.21.17.35.18; Thu, 21 May 2020 17:35:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 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 S1727022AbgEVAfI (ORCPT + 99 others); Thu, 21 May 2020 20:35:08 -0400 Received: from mga14.intel.com ([192.55.52.115]:55687 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbgEVAfH (ORCPT ); Thu, 21 May 2020 20:35:07 -0400 IronPort-SDR: 1NYvPArfHhuoSgX+q8igRZ3DqBqb3n5LJ0spBEFdS8LWYokerXlh/qKyJlLPMHdSNw44kVYs1B XFSU2EzGbsmg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2020 17:35:07 -0700 IronPort-SDR: ykPy84sq/hpIYbwmCFXpbexrXmv9QDvgLVwb6h9pUPV+kk3x68biP7rCDx/9bbgRQXQJRv9L09 013nudNrSvOw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,419,1583222400"; d="scan'208";a="300961698" Received: from nsalivat-mobl.amr.corp.intel.com (HELO ingas-nuc1.sea.intel.com) ([10.254.98.52]) by orsmga008.jf.intel.com with ESMTP; 21 May 2020 17:35:07 -0700 From: Inga Stotland To: linux-bluetooth@vger.kernel.org Cc: brian.gix@intel.com, Inga Stotland Subject: [PATCH BlueZ 09/10] mesh: Fix memory leak in Create, Import & Attach methods Date: Thu, 21 May 2020 17:35:00 -0700 Message-Id: <20200522003501.106165-10-inga.stotland@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200522003501.106165-1-inga.stotland@intel.com> References: <20200522003501.106165-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 ensures that every time l_dbus_message_ref() is used to preserve a message for a pending method reply, there is a matching call to l_dbus_message_unref(). --- mesh/mesh.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mesh/mesh.c b/mesh/mesh.c index c68436caa..6f8974745 100644 --- a/mesh/mesh.c +++ b/mesh/mesh.c @@ -309,6 +309,7 @@ static void pending_request_exit(void *data) reply = dbus_error(msg, MESH_ERROR_FAILED, "Failed. Exiting"); l_dbus_send(dbus_get_bus(), reply); + l_dbus_message_unref(msg); } static void free_pending_join_call(bool failed) @@ -628,6 +629,7 @@ static void attach_ready_cb(void *user_data, int status, struct mesh_node *node) reply = dbus_error(pending_msg, status, "Attach failed"); l_dbus_send(dbus_get_bus(), reply); + l_dbus_message_unref(pending_msg); } static struct l_dbus_message *attach_call(struct l_dbus *dbus, @@ -700,6 +702,7 @@ static void create_node_ready_cb(void *user_data, int status, if (status != MESH_ERROR_NONE) { reply = dbus_error(pending_msg, status, NULL); l_dbus_send(dbus_get_bus(), reply); + l_dbus_message_unref(pending_msg); return; } @@ -719,6 +722,7 @@ static void create_node_ready_cb(void *user_data, int status, l_dbus_message_set_arguments(msg, "t", l_get_be64(token)); dbus_send_with_timeout(dbus, msg, create_join_complete_reply_cb, node, DEFAULT_DBUS_TIMEOUT); + l_dbus_message_unref(pending_msg); } static struct l_dbus_message *create_network_call(struct l_dbus *dbus, -- 2.26.2