Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3457570iog; Mon, 20 Jun 2022 21:37:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tsXV/ID4Hm3aSIxAXr/jFjCdq/hor0fnOmJENHFXHC827LFBMS4plnARXfSXR28ECqWbOw X-Received: by 2002:a05:6402:42cb:b0:435:8c3b:faf8 with SMTP id i11-20020a05640242cb00b004358c3bfaf8mr6498670edc.300.1655786256642; Mon, 20 Jun 2022 21:37:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655786256; cv=none; d=google.com; s=arc-20160816; b=TWbKQr4QF9RtsCJm2D7ycFTQMkM5L3sSIN2GhKcRbvBiehgZoxIkd4YpUmoolL0Li6 xLIF6q3vqUGWM/2qHxvt93z5LSQ9Ku6tkj4jcXkwPWGiqhdS+/11MXYc4YvIFwjGTkOU +iCjf2MWiISEfMKjOdHoc20heE+ZzRUqdGGbA6XwM4juzeOzKYR08g11NjZlIUjVO5i9 RE7C0VpUvAHNT5UCIIwf7PZcZfXcQVPsPgj+14zItfiA+bqFe/g1jjsqFGVgx6NDZOJk IbzBRan0oGk04jo+zlAicNElToVHfssyTEgyoWC96lBzimzwUmNWGvMrUp7PWfHGF2Cw proQ== 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:references:in-reply-to:message-id:date:subject:cc:to :from; bh=cJZccEMyyevP8Yb2SOp4I/BTK8NhKdjru5iCod2/E9w=; b=TLvGDTdRBxNDoebMIrggxkYaRdrwqAw7VHvU66fEFAs9PLntxRcy/qatY4rQa5acia m7RXnBz304axE1WVYLUYcZh1X04gfraazMGcz7Yvzaf08GbXyxJCSeZtF0TVZH4ONhQl Ec+eDYipX2XZ6Hrd0eKgnFf7Z0WedONcSXScEGm8lmglqru28go/Wg3164OcklA65CxE W4i+xRmXpCGmLRHZwYxtyunv3A87gkZwQqFE1mk6XyrmUNTYDQHbiueQbAQfGZIKj5VO stkuq/TuM5Lipqeb3vkzex2QP04PSwq/LROsfW5GcwxfN0jjkDvdKYbHeGdDguCmqw1a Lx0w== 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 w5-20020a056402268500b0042dcf96f4b1si2283102edd.23.2022.06.20.21.36.48; Mon, 20 Jun 2022 21:37:36 -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 S1343702AbiFUEbv (ORCPT + 99 others); Tue, 21 Jun 2022 00:31:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236377AbiFUEbt (ORCPT ); Tue, 21 Jun 2022 00:31:49 -0400 X-Greylist: delayed 9211 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 20 Jun 2022 21:31:48 PDT Received: from smtpbgjp3.qq.com. (smtpbgjp3.qq.com [54.92.39.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50226B7FD for ; Mon, 20 Jun 2022 21:31:48 -0700 (PDT) X-QQ-mid: bizesmtp75t1655785902tfvg4y03 Received: from localhost.localdomain ( [113.57.152.160]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 21 Jun 2022 12:31:42 +0800 (CST) X-QQ-SSF: 01400000000000D0G000000A0000000 X-QQ-FEAT: xoS364mEyr2n0PaWh1CKP6IurI0fr8dGujIheX7snLbSk9VKXkZQ0SnS9qZIy EcVlo9hN6FonT5IkQ8HQ1UGpCion17MFWT0jfOgwDUDHV9AzG5By/4B8mgSFzxcKC/AzZu8 hhFC3K1Ksj4gmEbMLwAEUehW4Iqvt1W2CxRh1VIPt0rm4/h2QRG61MLq8LmOvllOyUnp4gX WHvLBVzPlP/5HVe8FKGP1R5rExWIIlz6gLTZDovfgwTuny6C5jJLKxqWxmnKIIL/pBMWOrU XNNdc9NAJpXf3l9SArQHnizcNEeNq7KP+cHBLY+HQoXYlD+qzX8u43ukLvDBERBnfBc/USM JHUEeYbwqUrqp/bPcw11zmHeGYcjA== X-QQ-GoodBg: 1 From: Chengyi Zhao To: linux-bluetooth@vger.kernel.org Cc: Chengyi Subject: [PATCH BlueZ 1/1] avdtp: Free discover when send_request returns error Date: Tue, 21 Jun 2022 12:31:33 +0800 Message-Id: <20220621043133.7720-2-zhaochengyi@uniontech.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220621043133.7720-1-zhaochengyi@uniontech.com> References: <20220621043133.7720-1-zhaochengyi@uniontech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybgforeign:qybgforeign9 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 From: Chengyi When send_request returns an error, session->discover should be released here, so that the next time the program enters avdtp_discover, the -EBUSY error will not be returned. --- profiles/audio/avdtp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c index bc7afad81..0d2213ea2 100644 --- a/profiles/audio/avdtp.c +++ b/profiles/audio/avdtp.c @@ -3429,6 +3429,9 @@ int avdtp_discover(struct avdtp *session, avdtp_discover_cb_t cb, if (err == 0) { session->discover->cb = cb; session->discover->user_data = user_data; + } else if (session->discover) { + g_free(session->discover); + session->discover = NULL; } return err; -- 2.20.1