[vlc-devel] commit: Check only one time the return value of malloc. ( Rémi Duraffort )
git version control
git at videolan.org
Mon Mar 3 15:33:31 CET 2008
vlc | branch: master | Rémi Duraffort <ivoire at via.ecp.fr> | Mon Mar 3 14:55:52 2008 +0100| [c9c5170b8ad691bbf06111e08f9f911e68484fa8]
Check only one time the return value of malloc.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c9c5170b8ad691bbf06111e08f9f911e68484fa8
---
src/modules/modules.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/modules/modules.c b/src/modules/modules.c
index bfd4578..29594e1 100644
--- a/src/modules/modules.c
+++ b/src/modules/modules.c
@@ -875,6 +875,9 @@ module_config_t *module_GetConfig( const module_t *module, unsigned *restrict ps
assert( psize != NULL );
*psize = 0;
+ if( !config )
+ return NULL;
+
for( i = 0, j = 0; i < size; i++ )
{
const module_config_t *item = module->p_config + i;
@@ -883,8 +886,7 @@ module_config_t *module_GetConfig( const module_t *module, unsigned *restrict ps
|| item->b_removed /* removed option */ )
continue;
- if( config != NULL )
- memcpy( config + j, item, sizeof( *config ) );
+ memcpy( config + j, item, sizeof( *config ) );
j++;
}
*psize = j;
More information about the vlc-devel
mailing list