a2dp: Fix crash when endpoint respond with an error
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Fri, 3 May 2019 07:51:34 +0000 (10:51 +0300)
committerhimanshu <h.himanshu@samsung.com>
Tue, 11 Feb 2020 08:57:47 +0000 (14:27 +0530)
If endpoint respond with an error the callback will be called with size
set to -1 not 0.

Change-Id: I70304846610fce7e47fb01a630a185864f6a1ac5
Signed-off-by: himanshu <h.himanshu@samsung.com>
profiles/audio/a2dp.c

index 4c66c92..f93505c 100644 (file)
@@ -2552,7 +2552,7 @@ static void select_cb(struct a2dp_setup *setup, void *ret, int size)
        struct avdtp_media_codec_capability *codec;
        int err;
 
-       if (size) {
+       if (size >= 0) {
                caps_add_codec(&setup->caps, setup->sep->codec, ret, size);
                goto done;
        }