Commit 5d085ee8 authored by Rémi Duraffort's avatar Rémi Duraffort

Use asprintf and check for the return value. (better than malloc+sprintf)

parent a1d4c652
...@@ -883,10 +883,8 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, ...@@ -883,10 +883,8 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
*psz_parser = '\0'; *psz_parser = '\0';
psz_parser++; psz_parser++;
} }
psz_temp = (char *)malloc( strlen(psz_module) + sizeof(",none") ); if( asprintf( &psz_temp, "%s,none", psz_module ) != -1)
if( psz_temp )
{ {
sprintf( psz_temp, "%s,none", psz_module );
libvlc_InternalAddIntf( p_libvlc, psz_temp ); libvlc_InternalAddIntf( p_libvlc, psz_temp );
free( psz_temp ); free( psz_temp );
} }
......
...@@ -1577,9 +1577,9 @@ int __var_Command( vlc_object_t *p_this, const char *psz_name, ...@@ -1577,9 +1577,9 @@ int __var_Command( vlc_object_t *p_this, const char *psz_name,
if( psz_msg ) if( psz_msg )
{ {
*psz_msg = (char*)malloc( 80 ); if( asprintf( psz_msg, "%s on object %s returned %i (%s)",
sprintf( *psz_msg, "%s on object %s returned %i (%s)", psz_cmd, psz_name, i_ret, vlc_error( i_ret ) ) == -1)
psz_cmd, psz_name, i_ret, vlc_error( i_ret ) ); *psz_msg = NULL;
} }
return i_ret; return i_ret;
......
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