Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp8986144pxu; Mon, 28 Dec 2020 03:37:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJxei361uu7gB3OBkFwEOyG9PcimY1T+IxlyURCmFHFgf9QZy1wg4POXnBZKqIHsIfVUxDtf X-Received: by 2002:a17:906:40d3:: with SMTP id a19mr40432525ejk.98.1609155434677; Mon, 28 Dec 2020 03:37:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609155434; cv=none; d=google.com; s=arc-20160816; b=vL1PhWRj5v3TQNd7rAPYn1QboLrUwkXhAOo0aFL6Jd6Yb5NyZteimQXgFuRn3D30bW bzvEpgAHvWCwT6KTL8xmEjXxndeYuI1BG+IOQHN65ZIa0RWmqbSlvLUaExTJtQc6w1WP XC1YnueqkoxHmg4TtrcjTOiMyqA/nETqeuFHNwZMSp5/h0Xdoky7Pv1JiZnTEs0LjmvA YSEBkt/q0yHepR87jylTBJuydchDJWmSMoMgQgX+lWlwr1PwbVb6uPFXinscF1Xfo/+h T8taFlcsJUH7UwRE10A5tlhIm+fDeq+3JcggCbjDIuaRjxxedRMeR70d53m5b5w6tpr2 z4Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:sender:dkim-signature; bh=D6yQ0aeiUTF84rpACa7tV0EEPiv+8c73o+8fQ16hv50=; b=s61sB/u+tnVruBf8X9bA4sV/PW2zG+bAUoxv3/vuzul+bW+VmlNad7t2DPmPSxl72G fXYIjAGLSaEWV2NFbUzcYJNhj/Jt1djFE/EIJUdc194aHopVKBORnArFhCUXrlSkCdM+ iHHSpV/vyD5d8He7PHfwaEB8SAbZHytmA8QTDtbu7MbgKyVd+8MUi1J17vzQ0TrXuwQb XePmfAOCSSqkYWgW3ydsTyj5NsG4BvHp52cLfKyUFmGeS2wIkc7egjjMwz92PykP8tV/ TaRUNyoBRQPmSC03NZhu3rFVQlduEE/N5Vft5NsEY/lHhD7V/YRXoqOmHPWah4WVVOco lEHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=DON27MLo; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k3si19939049edr.372.2020.12.28.03.36.43; Mon, 28 Dec 2020 03:37:14 -0800 (PST) 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; dkim=pass header.i=@google.com header.s=20161025 header.b=DON27MLo; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727374AbgL1LfS (ORCPT + 99 others); Mon, 28 Dec 2020 06:35:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727329AbgL1LfR (ORCPT ); Mon, 28 Dec 2020 06:35:17 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70524C061798 for ; Mon, 28 Dec 2020 03:34:37 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id g17so17930619ybh.5 for ; Mon, 28 Dec 2020 03:34:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=D6yQ0aeiUTF84rpACa7tV0EEPiv+8c73o+8fQ16hv50=; b=DON27MLoCDLCsJFbTf51DMjkvUbLoK87r8WSuIUp+tymFX3tLE1SipNYsjfK9UPrtJ QEI/jHkuntSq8SEEdaIUe+kIg5feZRWlGz4Z4kbQA1VG7EgNQeRAl8od679KG5snkYl9 ORER+yo51+mG7gV1DMP9YSl/8JF0PYfmuXrq1BNkocemZMtyzJ9n+hZg/yIP4g6ZOBwR DLBtIHVwjuW2Osc6k0PkWFaDVT39Qr9qp/d0H5anQLcKWknklZmgu9luJaZXdjpqWb3S CF94845spOA/CaiKhbM7xui7nKmG7wvE1lgukswysudUThgGAi9fIhyHCBJNZWY1rH09 H5Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=D6yQ0aeiUTF84rpACa7tV0EEPiv+8c73o+8fQ16hv50=; b=ZPawr6lHbwOxWW8M0NrnbvP7mRGEJTlxNM1ootR4wHdImKCdO+e+ZNZ9pM8SbIChgE 5W4aGl6MjwC8xXqv4Ay47fetYIaSSwjsIVOJsSP9n2krE09w3B9SWIA1B4JGOvbjRHfw /6OPtsBV2Rx57PhyOSSA2U9I7rd1GUjeR1+WOLgYMBQxcHlOYBUVihozJK+O2bW2j5h5 mqwFxDjzPD+LhOLDrjf6kRGbaqAVGRQvg8E94yrs7Zl/u2cs7H2dELBt+Dn15PV/FH5W eNVz8b0poKnsDjU33poa8hG3Rgus8ab39cnQy4mGANKxixD+7k3vC9gnNRfOPyK+E43t PO6g== X-Gm-Message-State: AOAM530Nc8VFRKPNqn9KXnLdH2nh8zBSV5Bz2Ecd/h6kL2oMFfH6p7ZY w5bjwwwg5FijoFtmI4VWF7rPLiFaIR7jJbCbEZ5X0UuFRRxfeLOXskw4tLfw36b/jKjja2zRhA/ AXQHXnvMTf5f+svj0PXLBlEq2ypMqaYHCq6eiwRy9cRMqNBftUnQKlJiwB/lb6PrBB/iuYo4Uaj SZglCEJIZt1Ko= Sender: "howardchung via sendgmr" X-Received: from howardchung-p920.tpe.corp.google.com ([2401:fa00:1:10:f693:9fff:fef4:4e45]) (user=howardchung job=sendgmr) by 2002:a25:aa88:: with SMTP id t8mr62078374ybi.292.1609155276643; Mon, 28 Dec 2020 03:34:36 -0800 (PST) Date: Mon, 28 Dec 2020 19:34:20 +0800 In-Reply-To: <20201228193351.Bluez.v3.1.Ie32770d0eed2e7739ce9d17d920766fb6aee8583@changeid> Message-Id: <20201228193351.Bluez.v3.4.I43884adadc00a5095dd03d2261a71dc2ba80d986@changeid> Mime-Version: 1.0 References: <20201228193351.Bluez.v3.1.Ie32770d0eed2e7739ce9d17d920766fb6aee8583@changeid> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog Subject: [Bluez PATCH v3 4/4] shared/mgmt: Fix memory leak in mgmt_tlv_list From: Howard Chung To: linux-bluetooth , luiz.dentz@gmail.com Cc: mcchou@chromium.org, mmandlik@chromium.org, apusaka@chromium.org, Howard Chung Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This patch freed the mgmt_tlv properly in mgmt_tlv_list_free. Reviewed-by: apusaka@chromium.org Reviewed-by: mcchou@chromium.org --- (no changes since v2) Changes in v2: - Fix incompatible pointer type error of mgmt_tlv_free src/shared/mgmt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/shared/mgmt.c b/src/shared/mgmt.c index dc8107846668..0d0c957709d7 100644 --- a/src/shared/mgmt.c +++ b/src/shared/mgmt.c @@ -588,14 +588,15 @@ static struct mgmt_tlv *mgmt_tlv_new(uint16_t type, uint8_t length, return entry; } -static void mgmt_tlv_free(struct mgmt_tlv *entry) +static void mgmt_tlv_free(void *data) { + struct mgmt_tlv *entry = data; free(entry); } void mgmt_tlv_list_free(struct mgmt_tlv_list *tlv_list) { - queue_destroy(tlv_list->tlv_queue, NULL); + queue_destroy(tlv_list->tlv_queue, mgmt_tlv_free); free(tlv_list); } -- 2.29.2.729.g45daf8777d-goog