a2dp-ldac: free handle on error

This commit is contained in:
Wim Taymans 2020-12-03 11:18:27 +01:00
parent 908e3f3d1f
commit 67694a1491

View file

@ -131,6 +131,8 @@ static int codec_get_num_blocks(void *data, size_t mtu)
size_t rtp_size = sizeof(struct rtp_header) + sizeof(struct rtp_payload);
size_t frame_count = (mtu - rtp_size) / this->frame_length;
this->mtu = mtu;
/* frame_count is only 4 bit number */
if (frame_count > 15)
frame_count = 15;
@ -243,6 +245,8 @@ static void *codec_init(uint32_t flags, void *config, size_t config_len, struct
error_errno:
res = -errno;
error:
if (this->ldac)
ldacBT_free_handle(this->ldac);
free(this);
errno = -res;
return NULL;