diff --git a/source/audiolib/src/flac.cpp b/source/audiolib/src/flac.cpp index 1fe1fdd6f..4ee9e5344 100644 --- a/source/audiolib/src/flac.cpp +++ b/source/audiolib/src/flac.cpp @@ -462,6 +462,7 @@ int32_t MV_PlayFLAC(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t lo /*metadata_flac_stream*/ NULL, error_flac_stream, (void *)fd) != FLAC__STREAM_DECODER_INIT_STATUS_OK) { + free(fd); MV_Printf("MV_PlayFLAC: %s\n", FLAC__stream_decoder_get_resolved_state_string(fd->stream)); MV_SetErrorCode(MV_InvalidFile); return MV_Error; diff --git a/source/audiolib/src/vorbis.cpp b/source/audiolib/src/vorbis.cpp index 19f31a0ea..9d16cb0bc 100644 --- a/source/audiolib/src/vorbis.cpp +++ b/source/audiolib/src/vorbis.cpp @@ -398,6 +398,7 @@ int32_t MV_PlayVorbis(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t if (status < 0) { + free(vd); MV_Printf("MV_PlayVorbis: err %d\n", status); MV_SetErrorCode(MV_InvalidFile); return MV_Error; diff --git a/source/audiolib/src/xmp.cpp b/source/audiolib/src/xmp.cpp index fe630d050..11a613bae 100644 --- a/source/audiolib/src/xmp.cpp +++ b/source/audiolib/src/xmp.cpp @@ -138,6 +138,7 @@ int32_t MV_PlayXMP(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loo if ((retval = xmp_load_module_from_memory(xmpd->context, ptr, ptrlength)) != 0) { + free(xmpd); MV_Printf("MV_PlayXMP: xmp_load_module_from_memory failed (%i)\n", retval); MV_SetErrorCode(MV_InvalidFile); return MV_Error;