mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-30 07:34:27 +08:00
android/hal-audio: Do not allocate memory if fd < 0
Fixes memory leak when returning bad fd we still allocate memory which is not freed in the caller function audio_open_output_stream().
This commit is contained in:
parent
d8beaba79f
commit
014471cae8
@ -637,6 +637,9 @@ static int audio_ipc_cmd(uint8_t service_id, uint8_t opcode, uint16_t len,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (*fd < 0)
|
||||
goto failed;
|
||||
}
|
||||
|
||||
if (rsp_len)
|
||||
@ -713,7 +716,6 @@ static int ipc_open_stream_cmd(uint8_t endpoint_id, uint16_t *mtu, int *fd,
|
||||
|
||||
result = audio_ipc_cmd(AUDIO_SERVICE_ID, AUDIO_OP_OPEN_STREAM,
|
||||
sizeof(cmd), &cmd, &rsp_len, rsp, fd);
|
||||
|
||||
if (result == AUDIO_STATUS_SUCCESS) {
|
||||
size_t buf_len = sizeof(struct audio_preset) +
|
||||
rsp->preset[0].len;
|
||||
|
Loading…
Reference in New Issue
Block a user