mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-08-17 17:05:50 +00:00
Fix buffer leak when the audio receive thread dies
This commit is contained in:
parent
a933886537
commit
cb43494cd0
@ -158,7 +158,7 @@ static void ReceiveThreadProc(void* context) {
|
||||
if (packet == NULL) {
|
||||
Limelog("Audio Receive: malloc() failed\n");
|
||||
ListenerCallbacks.connectionTerminated(-1);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ static void ReceiveThreadProc(void* context) {
|
||||
Limelog("Audio Receive: recv() failed: %d\n", (int)LastSocketError());
|
||||
free(packet);
|
||||
ListenerCallbacks.connectionTerminated(LastSocketError());
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
if (packet->size < sizeof(RTP_PACKET)) {
|
||||
@ -189,7 +189,7 @@ static void ReceiveThreadProc(void* context) {
|
||||
if ((AudioCallbacks.capabilities & CAPABILITY_DIRECT_SUBMIT) == 0) {
|
||||
if (!queuePacketToLbq(&packet)) {
|
||||
// An exit signal was received
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -208,16 +208,25 @@ static void ReceiveThreadProc(void* context) {
|
||||
if ((AudioCallbacks.capabilities & CAPABILITY_DIRECT_SUBMIT) == 0) {
|
||||
if (!queuePacketToLbq(&packet)) {
|
||||
// An exit signal was received
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
decodeInputData(packet);
|
||||
}
|
||||
}
|
||||
|
||||
// Break on exit
|
||||
if (packet != NULL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (packet != NULL) {
|
||||
free(packet);
|
||||
}
|
||||
}
|
||||
|
||||
static void DecoderThreadProc(void* context) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user