plug memory leak

This commit is contained in:
Eric House 2023-03-04 08:54:31 -08:00
parent eb5ed2b96d
commit 4ec6cfe17d
3 changed files with 6 additions and 7 deletions

View file

@ -594,7 +594,7 @@ game_dispose( XWGame* game, XWEnv xwe )
static void static void
disposePlayerInfoInt( MPFORMAL CurGameInfo* gi ) disposePlayerInfoInt( MPFORMAL CurGameInfo* gi )
{ {
for ( int ii = 0; ii < gi->nPlayers; ++ii ) { for ( int ii = 0; ii < VSIZE(gi->players); ++ii ) {
LocalPlayer* lp = &gi->players[ii]; LocalPlayer* lp = &gi->players[ii];
XP_FREEP( mpool, &lp->name ); XP_FREEP( mpool, &lp->name );
XP_FREEP( mpool, &lp->password ); XP_FREEP( mpool, &lp->password );

View file

@ -159,7 +159,7 @@ mpool_destroy( MemPoolCtx* mpool )
MemPoolEntry* entry; MemPoolEntry* entry;
for ( entry = mpool->usedList; !!entry; entry = entry->next ) { for ( entry = mpool->usedList; !!entry; entry = entry->next ) {
#ifndef FOR_GREMLINS /* I don't want to hear about this right now */ #ifndef FOR_GREMLINS /* I don't want to hear about this right now */
XP_LOGFF( "ptr: " XP_P "; index=%d, allocated %s, ln %d of %s\n", XP_LOGFF( "ptr: " XP_P "; index=%d, allocated %s(), ln %d of %s\n",
entry->ptr, entry->index, entry->ptr, entry->index,
entry->func, entry->lineNo, entry->fileName ); entry->func, entry->lineNo, entry->fileName );
#ifdef DEBUG #ifdef DEBUG
@ -219,8 +219,8 @@ mpool_alloc( MemPoolCtx* mpool, XP_U32 size, const char* file,
} }
#ifdef MPOOL_DEBUG #ifdef MPOOL_DEBUG
XP_LOGF( "%s(size=%ld,index=%d,file=%s,lineNo=%ld)=>%p", XP_LOGFF( "(size=%d,index=%d,file=%s,lineNo=%d)=>%p",
__func__, size, entry->index, file, lineNo, entry->ptr ); size, entry->index, file, lineNo, entry->ptr );
#endif #endif
result = entry->ptr; result = entry->ptr;
@ -311,7 +311,7 @@ mpool_free( MemPoolCtx* mpool, void* ptr, const char* file,
} else { } else {
#ifdef MPOOL_DEBUG #ifdef MPOOL_DEBUG
XP_LOGFF( "(ptr=%p):size=%ld,index=%d,func=%s,file=%s,lineNo=%ld); called from %s", XP_LOGFF( "(ptr=%p):size=%d,index=%d,func=%s,file=%s,lineNo=%d); called from %s",
entry->ptr, entry->size, entry->index, entry->func, entry->fileName, entry->ptr, entry->size, entry->index, entry->func, entry->fileName,
entry->lineNo, func ); entry->lineNo, func );
#else #else

View file

@ -746,8 +746,7 @@ gboolean
gtkNewGameDialog( GtkGameGlobals* globals, CurGameInfo* gi, CommsAddrRec* addr, gtkNewGameDialog( GtkGameGlobals* globals, CurGameInfo* gi, CommsAddrRec* addr,
XP_Bool isNewGame, XP_Bool fireConnDlg ) XP_Bool isNewGame, XP_Bool fireConnDlg )
{ {
GtkNewGameState state; GtkNewGameState state = {0};
XP_MEMSET( &state, 0, sizeof(state) );
state.globals = globals; state.globals = globals;
state.gi = gi; state.gi = gi;