From 0f586ce05f8f5874e1779dc136e03bc3d157f7ce Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 29 Mar 2014 12:17:55 -0400 Subject: [PATCH] Fix memory leak in audio stream code --- limelight-common/AudioStream.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/limelight-common/AudioStream.c b/limelight-common/AudioStream.c index d6aba92..980bd3d 100644 --- a/limelight-common/AudioStream.c +++ b/limelight-common/AudioStream.c @@ -112,12 +112,12 @@ static void DecoderThreadProc(void* context) { if (length < sizeof(RTP_PACKET)) { Limelog("Runt packet\n"); - continue; + goto freeandcontinue; } if (rtp->packetType != 97) { // Not audio - continue; + goto freeandcontinue; } rtp->sequenceNumber = htons(rtp->sequenceNumber); @@ -131,6 +131,9 @@ static void DecoderThreadProc(void* context) { lastSeq = rtp->sequenceNumber; callbacks.decodeAndPlaySample((char *) (rtp + 1), length - sizeof(*rtp)); + + freeandcontinue: + free(data); } }