Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp13625930pxu; Sun, 3 Jan 2021 23:03:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJw0IpNrdTHOB2bB4lw/+hi1/oBr/bdqolQS5W1rNscDz8f2vePe5jBWMzX/cvgWx4DMQVZ8 X-Received: by 2002:aa7:d74f:: with SMTP id a15mr70549365eds.344.1609743829535; Sun, 03 Jan 2021 23:03:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609743829; cv=none; d=google.com; s=arc-20160816; b=Nn+fJO2Jk6MuWSIJWPY1g67tAwHidrzRAgwm36bJNIC0eiIzD+32bhRt52EEq57mgh wyPcz8YttnSiTsgr3wldnovhRH7v5jC4wMoSpGscnLL67dxkzI+/DW8vBltvo5dvoIJw rLFa2LIyIteKdwgqIhpEdf+lL8cXmwdy2choofsqv87XAmN4xNRvT2JTX5J0LcobaKzb F8sLe8NwrfIXPQpi41k2f6rY+vDEV38wjHhenTWAb4csajr90Q6xMphRc6UZHklEaFkR YlM2LUN+bJGgsVvSrO4B4EWZLszAvGMo814ehEUp0TPXjheeC89jm5nOiwAbnjflMiPY 93GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=xEeTa/tdTuj74rAp0JUEZzKZpJ8GXzxWZznq1l+7qTo=; b=dQt0cnfMkKTUDMjSp0aoM7ZBf64WxsGB6AbvcAaPjb6IpG0EZ9iZu8Z49Ox/rUvpNz 1gk/RKB5YazMXp61iJsjJTwn+1JiXIP61086aNZmYnDh1YXiB66vPhk5+ImpQg5eU+SB cj5IwA2dO+hVL9EiPrjLpUPqwO+DynsT7m6iK4mdAzqoVI//18YDcws1dyTPfSVNxzF/ NPaH/QCUGvGuKB8Lib8v1WUVP6paz08s0A94zfq5G2N87QdM0YGno9X9K4ZJizOJKPEB BOPRMOOb9PFePrzNi3wF9hhxWvRyToTzog42FwDfME8d3j8Ji/nJQ3n4jO3lMQYasFFs 0hLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="MGo/84ot"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l16si28293718ejd.683.2021.01.03.23.03.14; Sun, 03 Jan 2021 23:03:49 -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=@gmail.com header.s=20161025 header.b="MGo/84ot"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726008AbhADHBC (ORCPT + 99 others); Mon, 4 Jan 2021 02:01:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726163AbhADHBC (ORCPT ); Mon, 4 Jan 2021 02:01:02 -0500 Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6D3DC061574 for ; Sun, 3 Jan 2021 23:00:21 -0800 (PST) Received: by mail-oi1-x234.google.com with SMTP id s75so31167644oih.1 for ; Sun, 03 Jan 2021 23:00:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xEeTa/tdTuj74rAp0JUEZzKZpJ8GXzxWZznq1l+7qTo=; b=MGo/84otoGIWGPyjGTuNl30Oh2y1eq3jcuq6s07t68UR25p57bhM3l5lXn8akTXaWn Z4uVg7JdxkVsbOCfmqX8Dtay5sK9bhR7/aHEREpuYumtcEtZRREfVSPdxIdklM54L/ZY dv1Ek01vuENobrB86T5VEXAfc2kS/WnVLh97pYb01ODA6NgJpyZ1+2w1hgnfnjTHySco YcOPwpAwVFFnqMH9ac9oSirGSsQKwoNcfWyyw2SKSWLxY8xY3cPDxFHGqvb5+wlKY++o sUMr4IYKX3cKCPj3fdHHpkFiQ0aneSOfZ8/O5rzsDu4RmFyaLqtLNyARu9ybKKZ6BQCL HHjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xEeTa/tdTuj74rAp0JUEZzKZpJ8GXzxWZznq1l+7qTo=; b=Cqmh50AZrAFuV+tWStj+T0xLb3KCSTPT7CG15GTrecRjaNc0cyfj1RQA/wS4v6jPmc lfPYtmdtO9oHPk8UyZ0SDNpTuXBawgvezgQQ0e/yFYRl6GdL+8yaW8vSVdii5BIk4OQd QsQHvAMmNNqiTs3H0rb5ZuYt8VYSg/UrEWb6LeZz7ksafp7JYEE78S3RKXY7C9ukyw8r o3B6/VERTNLsc5/Q39jMgeYWof390goZZNDSdrI3GGlWDbvfUTWUPc9McdK8zQx2ztRp 3XDowWd8EpPwRxl34pfXFGCGyTFh0Q6bSAgl5wtN7jL4Nf0zAfbXjVpJ00tM7i20Dhii pkag== X-Gm-Message-State: AOAM532CLZNFPHW5BgRIBiOhvviJuiQSzwMSjpc1hRDpdL3mN8YpJiIc kDUnHhxeyPdmni7I/zNvPHVe4LnvIBeQUoVlFks= X-Received: by 2002:aca:1917:: with SMTP id l23mr16941567oii.64.1609743621235; Sun, 03 Jan 2021 23:00:21 -0800 (PST) MIME-Version: 1.0 References: <20201228193351.Bluez.v3.1.Ie32770d0eed2e7739ce9d17d920766fb6aee8583@changeid> <20201228193351.Bluez.v3.4.I43884adadc00a5095dd03d2261a71dc2ba80d986@changeid> In-Reply-To: <20201228193351.Bluez.v3.4.I43884adadc00a5095dd03d2261a71dc2ba80d986@changeid> From: Luiz Augusto von Dentz Date: Sun, 3 Jan 2021 23:00:10 -0800 Message-ID: Subject: Re: [Bluez PATCH v3 4/4] shared/mgmt: Fix memory leak in mgmt_tlv_list To: Howard Chung Cc: linux-bluetooth , Miao-chen Chou , Manish Mandlik , Archie Pusaka Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Howard, On Mon, Dec 28, 2020 at 3:34 AM Howard Chung wrote: > > 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); It might be better to just pass free directly instead of mgmt_tlv_free since all it does currently is call free anyway. > free(tlv_list); > } > > -- > 2.29.2.729.g45daf8777d-goog > -- Luiz Augusto von Dentz