Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1857597ybk; Thu, 21 May 2020 17:35:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYCLZ6bthMYfV/wvCmwVePNeSPZi8lAIxikOttXfcyNqUclFA2dF91xTQ92CkmenoyNBQ1 X-Received: by 2002:a17:906:f112:: with SMTP id gv18mr5859068ejb.142.1590107749950; 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=yQVbZ3iPlvFvXkAJT1Zz5jtq15Tqsz7Pk4KQX3pPczzx6EPjwGHyP/SeP7EsDDXKfx 7bGipxWIOl7z5pr902eT9fuVXV/9U2wD8KO95q+g12UtuMomQOIHzQ9+HDcfIFeIN5gj nTcx18ggNJqttiWSUxxTNzRPFZx5wD98Uaj7vXobJwOoGfJlo+/wqeJRvEY7ohv6Hfh8 AiE9mvHG6YbZ5KqLqWn3ePOUv5qhbZxcW1xqanCm5Zl7iqRTIqAOF0qoh1oWee8LSQGK pPS3qs5crvCQ/r/a4kHy+vmW+DSJ0DEF6CmdJXirgItOdP8qv4uhSkEmkuqoYnOHAy/f xXlA== 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=rsuthlg1ILz1WpL4YkR+Nsvcau+PN1h4q/T5VtCzG0Y=; b=XjXgg3kfBOKeE1vctEA14fE2ID/B9J4sGRc4HKfWAzmvvgWZD3j2kEzSQz5/7fWKLL /YgxplpxvmmdbWhJoO7bx+/uWJPfrb6HCfspVNWHQ2nHR6Aaz1jI0gZ+8Cj5x5ycgJrT FvCNI+w97OJOFP4kBdg5ExFO7x9D7slKqt/pjD868HCe4H2+ch1TMyiVYfheNtEJhtNt 1cyPqoRA9XWbvtoDpxcEUQnHDEkO2cmztHHYzEcgUtHn86kwHxa4LuszntQbg2toxkyq OlfO5NEy7zZsdhXxZnuicS8TtPjV39gxFcV9lFzxNDufMoWeK1AI9Wyj45FAjVW+4KJV JFvA== 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 e2si3800714edn.240.2020.05.21.17.35.10; 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 S1726940AbgEVAfE (ORCPT + 99 others); Thu, 21 May 2020 20:35:04 -0400 Received: from mga14.intel.com ([192.55.52.115]:55682 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726785AbgEVAfE (ORCPT ); Thu, 21 May 2020 20:35:04 -0400 IronPort-SDR: 9p99lkuRkfCJdRVNc6VD7F/qKu4NAaiLPuG4NQyVq1EEnn27Xy7I+Zb1QRdtPLvh972g5bW4Pp lZDFqOo5+O/w== 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:03 -0700 IronPort-SDR: GuUDR3dBNjbPk5xEfBeo4C1ArmehHZK0cICr1QhFFnO0acponfyq1rRgXllz8LsHQZVxQsZFHj GKqTfZVs7sdg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,419,1583222400"; d="scan'208";a="300961660" 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:03 -0700 From: Inga Stotland To: linux-bluetooth@vger.kernel.org Cc: brian.gix@intel.com, Inga Stotland Subject: [PATCH BlueZ 02/10] mesh: Free allocated agent in mesh_remove_agent() Date: Thu, 21 May 2020 17:34:53 -0700 Message-Id: <20200522003501.106165-3-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 adds previously missing call to free memory allocated for agent structure. --- mesh/agent.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mesh/agent.c b/mesh/agent.c index a06cc2b99..4d200416f 100644 --- a/mesh/agent.c +++ b/mesh/agent.c @@ -188,9 +188,6 @@ static void agent_free(void *agent_data) mesh_agent_key_cb_t key_cb; mesh_agent_number_cb_t number_cb; - if (!l_queue_find(agents, simple_match, agent)) - return; - err = MESH_ERROR_DOES_NOT_EXIST; if (agent->req && agent->req->cb) { @@ -228,15 +225,16 @@ static void agent_free(void *agent_data) l_free(agent->path); l_free(agent->owner); + l_free(agent); } void mesh_agent_remove(struct mesh_agent *agent) { - if (!agent || !l_queue_find(agents, simple_match, agent)) + if (!agent) return; - agent_free(agent); - l_queue_remove(agents, agent); + if (l_queue_remove(agents, agent)) + agent_free(agent); } void mesh_agent_cleanup(void) -- 2.26.2