wmail: fixed memory leaks in skip-names.

This commit is contained in:
Jeremy Sowden 2019-06-12 21:37:22 +01:00 committed by Carlos R. Mafra
parent 6e48b4a431
commit 0fb61f1e49

View file

@ -159,7 +159,7 @@ static void AddSenderToSkipList( char *sender )
for( i = 0; i < numNames; ++i )
newList[i] = config.skipNames[i];
newList[i] = strdup( sender );
newList[i] = sender;
newList[i+1] = NULL;
free( config.skipNames );
config.skipNames = newList;
@ -202,10 +202,11 @@ void ResetConfigStrings( void )
config.backgroundColor = NULL;
}
if( !( config.givenOptions & CL_CHECKSUMFILENAME )) {
free( config.checksumFileName );
config.checksumFileName = NULL;
}
/*
* No corresponding command-line option.
*/
free( config.checksumFileName );
config.checksumFileName = NULL;
if( !( config.givenOptions & CL_CMDONMAIL )) {
free( config.cmdOnMail );
@ -216,6 +217,18 @@ void ResetConfigStrings( void )
free( config.useX11Font );
config.useX11Font = NULL;
}
/*
* No corresponding command-line option.
*/
if( config.skipNames != NULL )
{
char **n;
for( n = config.skipNames; *n; ++n )
free( *n );
free( config.skipNames );
config.skipNames = NULL;
}
}
static void PostProcessConfiguration( void )