Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp559453iog; Wed, 29 Jun 2022 05:56:53 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v+d6jPxa5UXzBHieLs75H0FDKx9OaP4YgYlLQvMNuxEez0IJkxoIcN+x3zESHuLD2+nmpS X-Received: by 2002:aa7:d90c:0:b0:435:6d09:e342 with SMTP id a12-20020aa7d90c000000b004356d09e342mr4215055edr.359.1656507413600; Wed, 29 Jun 2022 05:56:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656507413; cv=none; d=google.com; s=arc-20160816; b=OM5EADfOLzQ2rwaEQyV9vc0VVvxMAHdQDjqHDqnvRcWMFsa+8X9gn86I+MlyQ6w7a6 HAeJ6kQOmxpn63aOlrZoCnQqhKiugzeVapJZ/91f2cd50qCpn4Rke5TLIXJ6latqie7c rbG7lylLLS7pfy8idB29X4AoVCTPkjmvC8oR49WvNXqaiv5KyesRc6lzyjSY/ta2POs/ VJdy5i8pVN99po1U0n7EOw8zVtx6mSAL+Wads4KVmVJG2pSkcEvasyjcQWJVYgAvDbRH YuU3A2dGCubZvYpfdKyqXecYnwawqsfF886XPzW0z+PDPGlbT939ANhzT3AFjBW8MN7D 7i+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=u6gW8VJu4Yr2UsSVyYj8WxmKtRDGTrvvUwjLQrzvvOM=; b=EF5OT/0vn8M0jh9IsFmvR0WuMRg4IRV+1yU5hiQdU9CbMfZu1B8EN2yW8iivHuNI+1 NJCqJ/+qbY8s3C+JfLDZHSGPFJqQT5GTux3gJ6xyK+72FdzjQPnQhEfWLlXTZqYSEV1Z 898qx4xTxqnqHW6Q5zlc6HIC+zKFIEMPBLvexGet3ATz8AfmKZZD2eSmetSTYM904if5 w+BvEqKxxQtX6ccJyI3qcLpMsKrOImflKn26w7moJbiKGyIrrSaDY7h9kcrnS9A6jaMf hbeTO/qWjaSV06VLIJLTh3Dep/P+uoe0OhLkTkhvL2xQbIpcS1rRn5Izm0F25zGjFyN/ jW4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z1-20020a1709067e4100b00718d0985aa0si14991251ejr.247.2022.06.29.05.56.11; Wed, 29 Jun 2022 05:56:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232840AbiF2MrR (ORCPT + 99 others); Wed, 29 Jun 2022 08:47:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233434AbiF2MrQ (ORCPT ); Wed, 29 Jun 2022 08:47:16 -0400 Received: from smtpbguseast1.qq.com (smtpbguseast1.qq.com [54.204.34.129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4B3736179 for ; Wed, 29 Jun 2022 05:47:14 -0700 (PDT) X-QQ-mid: bizesmtp89t1656506823tf6s4aje Received: from localhost.localdomain ( [61.183.83.60]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 29 Jun 2022 20:46:57 +0800 (CST) X-QQ-SSF: 01400000002000B0F000B00A0000000 X-QQ-FEAT: j3hIXqmsyHZU6Mf95Mj3H0CRpUTcU+1oTH+pgTqdx3hwnV6EnmmvlNYq5RZ7l C6yz/nxdfxEd5BWsHEDh1d2wilKhPN4zqzBx9gmEmvXrzRoQdmYAk1eOFjNIhyxavoAFw/d JR9dtCaXhWaGUn6BWYpwqZgk14QC/0I6T8vmud3N5YSn5r51KVmLpro29vD84J45P9/2rhk 1OAlcBVjwM5N7EpN9ae/5X9mb2ZwwzJy97OJ8ubFGI7ht+pPpu/9qEnsKjhV6/MFd5Aci+0 lKBs/StPocpQPVlldX7TWWsjOZilyiBEztZl4++GUaI4qc1lqNMdrVyA0Q1prMPPhOSw== X-QQ-GoodBg: 2 From: lishengyu To: linux-bluetooth@vger.kernel.org Cc: lishengyu Subject: [PATCH BlueZ] avdtp: fix possible minor problems Date: Wed, 29 Jun 2022 20:46:56 +0800 Message-Id: <20220629124656.10174-1-lishengyu@uniontech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybgforeign:qybgforeign8 X-QQ-Bgrelay: 1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org It should always be considered that if send_request fails, sep should be removed from the list and the requested memory freed; --- profiles/audio/avdtp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c index 0d2213ea2..10ef380d4 100644 --- a/profiles/audio/avdtp.c +++ b/profiles/audio/avdtp.c @@ -2765,8 +2765,11 @@ static gboolean avdtp_discover_resp(struct avdtp *session, ret = send_request(session, TRUE, NULL, getcap_cmd, &req, sizeof(req)); - if (ret < 0) + if (ret < 0) { + session->seps = g_slist_remove(session->seps, sep); + g_free(sep); break; + } getcap_pending = TRUE; } -- 2.20.1