summaryrefslogtreecommitdiffhomepage
path: root/src/external
diff options
context:
space:
mode:
authorChris <[email protected]>2021-02-14 16:37:34 +0000
committerGitHub <[email protected]>2021-02-14 17:37:34 +0100
commitccb083af52989c8681aa8047cd6380f7081d3381 (patch)
tree95d4d049748c3ca881a764956381f113d2ea298e /src/external
parentc7476f0aa508b4d04428e340ef1ffddca5b90b9a (diff)
downloadraylib-ccb083af52989c8681aa8047cd6380f7081d3381.tar.gz
raylib-ccb083af52989c8681aa8047cd6380f7081d3381.zip
[raudio] Fix load and unload issues with Music (#1588)
* Add MUSIC_AUDIO_NONE to MusicContextType and format fixes - Useful to check the context type to see if the format is recognized. Defaulting to wav causes issues where formats are assumed to be wav. * Fix memory issues with LoadMusicStream and UnloadMusicStream - Set ctxType and ctxData even if the format fails to load. - Set ctxData to NULL if it fails and check for null inside UnloadMusicStream. - Change RL_MALLOC when loading formats to RL_CALLOC to prevent undefined behavior. - Add NULL check when unloading xm file.
Diffstat (limited to 'src/external')
-rw-r--r--src/external/jar_xm.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/external/jar_xm.h b/src/external/jar_xm.h
index 1839e619..bfd63ec0 100644
--- a/src/external/jar_xm.h
+++ b/src/external/jar_xm.h
@@ -696,7 +696,9 @@ int jar_xm_create_context_safe(jar_xm_context_t** ctxp, const char* moddata, siz
}
void jar_xm_free_context(jar_xm_context_t* ctx) {
- JARXM_FREE(ctx->allocated_memory);
+ if (ctx != NULL) {
+ JARXM_FREE(ctx->allocated_memory);
+ }
}
void jar_xm_set_max_loop_count(jar_xm_context_t* ctx, uint8_t loopcnt) {