From f400c40c7f41854020397995fcc5b67069d98239 Mon Sep 17 00:00:00 2001 From: Chengyi Date: Tue, 21 Jun 2022 12:31:33 +0800 Subject: [PATCH] avdtp: Free discover when send_request returns error 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. Signed-off-by: Manika Shrivastava Signed-off-by: Ayush Garg --- profiles/audio/avdtp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c index c046374..53c85a5 100644 --- a/profiles/audio/avdtp.c +++ b/profiles/audio/avdtp.c @@ -3963,6 +3963,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.7.4