mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-17 18:40:02 +00:00
SV_LoadProgs: Fixed potential memory leak if function failed (#46)
SV_LoadProgs: Fixed potential memory leak if function failed
This commit is contained in:
parent
76dae35955
commit
d14ce5ac39
@ -5026,8 +5026,13 @@ qboolean SV_LoadProgs( const char *name )
|
||||
svgame.pmove = &gpMove;
|
||||
svgame.globals = &gpGlobals;
|
||||
svgame.mempool = Mem_AllocPool( "Server Edicts Zone" );
|
||||
|
||||
svgame.hInstance = COM_LoadLibrary( name, true, false );
|
||||
if( !svgame.hInstance ) return false;
|
||||
if( !svgame.hInstance )
|
||||
{
|
||||
Mem_FreePool(&svgame.mempool);
|
||||
return false;
|
||||
}
|
||||
|
||||
// make sure what new dll functions is cleared
|
||||
memset( &svgame.dllFuncs2, 0, sizeof( svgame.dllFuncs2 ));
|
||||
@ -5047,6 +5052,7 @@ qboolean SV_LoadProgs( const char *name )
|
||||
COM_FreeLibrary( svgame.hInstance );
|
||||
Con_Printf( S_ERROR "SV_LoadProgs: failed to get address of GetEntityAPI proc\n" );
|
||||
svgame.hInstance = NULL;
|
||||
Mem_FreePool(&svgame.mempool);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -5057,6 +5063,7 @@ qboolean SV_LoadProgs( const char *name )
|
||||
COM_FreeLibrary( svgame.hInstance );
|
||||
Con_Printf( S_ERROR "SV_LoadProgs: failed to get address of GiveFnptrsToDll proc\n" );
|
||||
svgame.hInstance = NULL;
|
||||
Mem_FreePool(&svgame.mempool);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -5089,6 +5096,7 @@ qboolean SV_LoadProgs( const char *name )
|
||||
COM_FreeLibrary( svgame.hInstance );
|
||||
Con_Printf( S_ERROR "SV_LoadProgs: couldn't get entity API\n" );
|
||||
svgame.hInstance = NULL;
|
||||
Mem_FreePool(&svgame.mempool);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -5099,6 +5107,7 @@ qboolean SV_LoadProgs( const char *name )
|
||||
COM_FreeLibrary( svgame.hInstance );
|
||||
Con_Printf( S_ERROR "SV_LoadProgs: couldn't get entity API\n" );
|
||||
svgame.hInstance = NULL;
|
||||
Mem_FreePool(&svgame.mempool);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user