Paul P Komkoff Jr fixed malloc/free mismatch in the MikMod driver
authorSam Lantinga <slouken@libsdl.org>
Sun, 22 Jul 2012 16:13:27 -0700
changeset 58756cad6484b04
parent 586 c92001a2c18f
child 588 2ebb0d016f27
Paul P Komkoff Jr fixed malloc/free mismatch in the MikMod driver
CHANGES
dynamic_mod.c
dynamic_mod.h
music_mod.c
     1.1 --- a/CHANGES	Sun Mar 04 21:32:47 2012 +0000
     1.2 +++ b/CHANGES	Sun Jul 22 16:13:27 2012 -0700
     1.3 @@ -1,3 +1,7 @@
     1.4 +1.2.13:
     1.5 +Paul P Komkoff Jr - Sun Jul 22 16:12:28 PDT 2012
     1.6 + * Fixed malloc/free mismatch in the MikMod driver
     1.7 +
     1.8  1.2.12:
     1.9  Sam Lantinga - Sat Jan 14 22:00:29 2012 -0500
    1.10   * Fixed seek offset with SMPEG (was relative, should be absolute)
     2.1 --- a/dynamic_mod.c	Sun Mar 04 21:32:47 2012 +0000
     2.2 +++ b/dynamic_mod.c	Sun Jul 22 16:13:27 2012 -0700
     2.3 @@ -93,6 +93,13 @@
     2.4  			SDL_UnloadObject(mikmod.handle);
     2.5  			return -1;
     2.6  		}
     2.7 +		mikmod.MikMod_free =
     2.8 +			(void (*)(void*))
     2.9 +			SDL_LoadFunction(mikmod.handle, "MikMod_free");
    2.10 +		if ( mikmod.MikMod_free == NULL ) {
    2.11 +			SDL_UnloadObject(mikmod.handle);
    2.12 +			return -1;
    2.13 +		}
    2.14  		mikmod.Player_Active =
    2.15  			(BOOL (*)(void))
    2.16  			SDL_LoadFunction(mikmod.handle, "Player_Active");
     3.1 --- a/dynamic_mod.h	Sun Mar 04 21:32:47 2012 +0000
     3.2 +++ b/dynamic_mod.h	Sun Jul 22 16:13:27 2012 -0700
     3.3 @@ -35,6 +35,7 @@
     3.4  	void (*MikMod_RegisterDriver)(struct MDRIVER*);
     3.5  	int* MikMod_errno;
     3.6  	char* (*MikMod_strerror)(int);
     3.7 +	void (*MikMod_free)(void*);
     3.8  	BOOL (*Player_Active)(void);
     3.9  	void (*Player_Free)(MODULE*);
    3.10  	MODULE* (*Player_LoadGeneric)(MREADER*,int,BOOL);
     4.1 --- a/music_mod.c	Sun Mar 04 21:32:47 2012 +0000
     4.2 +++ b/music_mod.c	Sun Jul 22 16:13:27 2012 -0700
     4.3 @@ -109,13 +109,13 @@
     4.4  
     4.5  	list = mikmod.MikMod_InfoDriver();
     4.6  	if ( list )
     4.7 -	  free(list);
     4.8 +	  mikmod.MikMod_free(list);
     4.9  	else
    4.10  	  mikmod.MikMod_RegisterDriver(mikmod.drv_nos);
    4.11  
    4.12  	list = mikmod.MikMod_InfoLoader();
    4.13  	if ( list )
    4.14 -	  free(list);
    4.15 +	  mikmod.MikMod_free(list);
    4.16  	else
    4.17  	  mikmod.MikMod_RegisterAllLoaders();
    4.18