Commit c9c5170b authored by Rémi Duraffort's avatar Rémi Duraffort

Check only one time the return value of malloc.

parent e0431bc0
...@@ -875,6 +875,9 @@ module_config_t *module_GetConfig( const module_t *module, unsigned *restrict ps ...@@ -875,6 +875,9 @@ module_config_t *module_GetConfig( const module_t *module, unsigned *restrict ps
assert( psize != NULL ); assert( psize != NULL );
*psize = 0; *psize = 0;
if( !config )
return NULL;
for( i = 0, j = 0; i < size; i++ ) for( i = 0, j = 0; i < size; i++ )
{ {
const module_config_t *item = module->p_config + i; const module_config_t *item = module->p_config + i;
...@@ -883,7 +886,6 @@ module_config_t *module_GetConfig( const module_t *module, unsigned *restrict ps ...@@ -883,7 +886,6 @@ module_config_t *module_GetConfig( const module_t *module, unsigned *restrict ps
|| item->b_removed /* removed option */ ) || item->b_removed /* removed option */ )
continue; continue;
if( config != NULL )
memcpy( config + j, item, sizeof( *config ) ); memcpy( config + j, item, sizeof( *config ) );
j++; j++;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment