From 7e9f71c1c0b8fd1be5d9fa39f55fd0239ff02dcf Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Tue, 21 Apr 2015 13:35:46 -0700 Subject: [PATCH] Better cleanup in WAV code --- project/src/audio/format/WAV.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/project/src/audio/format/WAV.cpp b/project/src/audio/format/WAV.cpp index 71c3c068b..5e91c8fbe 100644 --- a/project/src/audio/format/WAV.cpp +++ b/project/src/audio/format/WAV.cpp @@ -73,6 +73,7 @@ namespace lime { if ((riff_header.chunkID[0] != 'R' || riff_header.chunkID[1] != 'I' || riff_header.chunkID[2] != 'F' || riff_header.chunkID[3] != 'F') || (riff_header.format[0] != 'W' || riff_header.format[1] != 'A' || riff_header.format[2] != 'V' || riff_header.format[3] != 'E')) { //LOG_SOUND ("Invalid RIFF or WAVE Header!\n"); + lime::fclose (file); return false; } @@ -88,6 +89,7 @@ namespace lime { if (result != 1) { LOG_SOUND ("Invalid Wave Format!\n"); + lime::fclose (file); return false; } @@ -120,6 +122,7 @@ namespace lime { if (result != 1) { LOG_SOUND ("Invalid Wav Data Header!\n"); + lime::fclose (file); return false; } @@ -141,6 +144,7 @@ namespace lime { if (!lime::fread (audioBuffer->data->Bytes (), wave_data.subChunkSize, 1, file)) { LOG_SOUND ("error loading WAVE data into struct!\n"); + lime::fclose (file); return false; }