diff --git a/media/webrtc/signaling/test/mediaconduit_unittests.cpp b/media/webrtc/signaling/test/mediaconduit_unittests.cpp index 5c5ffab31adb..174a14439ea4 100644 --- a/media/webrtc/signaling/test/mediaconduit_unittests.cpp +++ b/media/webrtc/signaling/test/mediaconduit_unittests.cpp @@ -301,12 +301,15 @@ void AudioSendAndReceive::GenerateAndReadSamples() FILE* inFile = fopen( iFile.c_str(), "wb+"); if(!inFile) { cerr << "Input File Creation Failed " << endl; + free(inbuf); return; } FILE* outFile = fopen( oFile.c_str(), "wb+"); if(!outFile) { cerr << "Output File Creation Failed " << endl; + free(inbuf); + fclose(inFile); return; } @@ -323,6 +326,8 @@ void AudioSendAndReceive::GenerateAndReadSamples() { if(!memcpy(audioInput.get(), inbuf, sampleLengthInBytes)) { + free(inbuf); + fclose(outFile); return; } @@ -350,6 +355,7 @@ void AudioSendAndReceive::GenerateAndReadSamples() }while(numSamplesReadFromInput < SAMPLES); FinishWaveHeader(outFile); + free(inbuf); fclose(outFile); }