Skip to content

Commit

Permalink
explicitly use MikMod_calloc for SAMPLOAD and MikMod_amalloc
Browse files Browse the repository at this point in the history
TODO: change MikMod_malloc() to use plain malloc, not calloc, and test
for unitialized memory errors.
  • Loading branch information
sezero committed Dec 25, 2021
1 parent 65efd9e commit 517966a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libmikmod/include/mikmod_internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ void MikMod_afree(void *); /* frees if ptr != NULL */
#endif

#else /* NO SIMD */
#define MikMod_amalloc MikMod_malloc
#define MikMod_amalloc(s) MikMod_calloc(1,(s))
#define MikMod_afree MikMod_free
#endif

Expand Down
2 changes: 1 addition & 1 deletion libmikmod/playercode/sloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ SAMPLOAD* SL_RegisterSample(SAMPLE* s,int type,MREADER* reader)
return NULL;

/* Allocate and add structure to the END of the list */
if(!(news=(SAMPLOAD*)MikMod_malloc(sizeof(SAMPLOAD)))) return NULL;
if(!(news=(SAMPLOAD*)MikMod_calloc(1, sizeof(SAMPLOAD)))) return NULL;

if(cruise) {
while(cruise->next) cruise=cruise->next;
Expand Down

0 comments on commit 517966a

Please sign in to comment.