Commit 322cd225 authored by Rémi Duraffort's avatar Rémi Duraffort

Check asprintf return value.

parent feb988a3
...@@ -584,7 +584,8 @@ char *GetTimedURIFragmentForTime( int seconds ) ...@@ -584,7 +584,8 @@ char *GetTimedURIFragmentForTime( int seconds )
{ {
char *psz_time; char *psz_time;
asprintf( &psz_time, "%d", seconds ); if( asprintf( &psz_time, "%d", seconds ) == -1 )
return NULL;
return psz_time; return psz_time;
} }
......
...@@ -345,19 +345,22 @@ static int OpenDll( decoder_t *p_dec ) ...@@ -345,19 +345,22 @@ static int OpenDll( decoder_t *p_dec )
for( i = 0; ppsz_path[i]; i++ ) for( i = 0; ppsz_path[i]; i++ )
{ {
/* Old format */ /* Old format */
asprintf( &psz_dll, "%s/%4.4s.so.6.0", ppsz_path[i], if( asprintf( &psz_dll, "%s/%4.4s.so.6.0", ppsz_path[i],
(char *)&p_dec->fmt_in.i_codec ); (char *)&p_dec->fmt_in.i_codec ) != -1 )
{
i_result = OpenNativeDll( p_dec, ppsz_path[i], psz_dll ); i_result = OpenNativeDll( p_dec, ppsz_path[i], psz_dll );
free( psz_dll ); free( psz_dll );
if( i_result == VLC_SUCCESS ) return VLC_SUCCESS; if( i_result == VLC_SUCCESS ) return VLC_SUCCESS;
}
/* New format */ /* New format */
asprintf( &psz_dll, "%s/%4.4s.so", ppsz_path[i], if( asprintf( &psz_dll, "%s/%4.4s.so", ppsz_path[i],
(char *)&p_dec->fmt_in.i_codec ); (char *)&p_dec->fmt_in.i_codec ) != -1 )
{
i_result = OpenNativeDll( p_dec, ppsz_path[i], psz_dll ); i_result = OpenNativeDll( p_dec, ppsz_path[i], psz_dll );
free( psz_dll ); free( psz_dll );
if( i_result == VLC_SUCCESS ) return VLC_SUCCESS; if( i_result == VLC_SUCCESS ) return VLC_SUCCESS;
}
} }
#endif #endif
...@@ -366,19 +369,23 @@ static int OpenDll( decoder_t *p_dec ) ...@@ -366,19 +369,23 @@ static int OpenDll( decoder_t *p_dec )
for( i = 0; ppsz_path[i]; i++ ) for( i = 0; ppsz_path[i]; i++ )
{ {
/* New format */ /* New format */
asprintf( &psz_dll, "%s\\%4.4s.dll", ppsz_path[i], if( asprintf( &psz_dll, "%s\\%4.4s.dll", ppsz_path[i],
(char *)&p_dec->fmt_in.i_codec ); (char *)&p_dec->fmt_in.i_codec ) != -1 )
{
i_result = OpenWin32Dll( p_dec, ppsz_path[i], psz_dll ); i_result = OpenWin32Dll( p_dec, ppsz_path[i], psz_dll );
free( psz_dll ); free( psz_dll );
if( i_result == VLC_SUCCESS ) return VLC_SUCCESS; if( i_result == VLC_SUCCESS ) return VLC_SUCCESS;
}
/* Old format */ /* Old format */
asprintf( &psz_dll, "%s\\%4.4s3260.dll", ppsz_path[i], if( asprintf( &psz_dll, "%s\\%4.4s3260.dll", ppsz_path[i],
(char *)&p_dec->fmt_in.i_codec ); (char *)&p_dec->fmt_in.i_codec ) != -1 )
{
i_result = OpenWin32Dll( p_dec, ppsz_path[i], psz_dll ); i_result = OpenWin32Dll( p_dec, ppsz_path[i], psz_dll );
free( psz_dll ); free( psz_dll );
if( i_result == VLC_SUCCESS ) return VLC_SUCCESS; if( i_result == VLC_SUCCESS ) return VLC_SUCCESS;
} }
}
#endif #endif
return VLC_EGENERIC; return VLC_EGENERIC;
......
...@@ -315,8 +315,8 @@ int ParseDirectory( intf_thread_t *p_intf, char *psz_root, ...@@ -315,8 +315,8 @@ int ParseDirectory( intf_thread_t *p_intf, char *psz_root,
if( b_index && ( p = strstr( f->file, "index." ) ) ) if( b_index && ( p = strstr( f->file, "index." ) ) )
{ {
asprintf( &psz_redir, "%s%s", f->name, p ); if( asprintf( &psz_redir, "%s%s", f->name, p ) != -1 )
{
msg_Dbg( p_intf, "redir=%s -> %s", psz_redir, f->name ); msg_Dbg( p_intf, "redir=%s -> %s", psz_redir, f->name );
f->p_redir2 = httpd_RedirectNew( p_sys->p_httpd_host, f->p_redir2 = httpd_RedirectNew( p_sys->p_httpd_host,
f->name, psz_redir ); f->name, psz_redir );
...@@ -326,6 +326,7 @@ int ParseDirectory( intf_thread_t *p_intf, char *psz_root, ...@@ -326,6 +326,7 @@ int ParseDirectory( intf_thread_t *p_intf, char *psz_root,
} }
} }
} }
}
free( user ); free( user );
free( password ); free( password );
......
...@@ -1190,17 +1190,20 @@ static int ASF_ReadObject_extended_content_description( stream_t *s, ...@@ -1190,17 +1190,20 @@ static int ASF_ReadObject_extended_content_description( stream_t *s,
else if( i_type == 3 ) else if( i_type == 3 )
{ {
/* DWord */ /* DWord */
asprintf( &p_ec->ppsz_value[i], "%d", ASF_READ4() ); if( asprintf( &p_ec->ppsz_value[i], "%d", ASF_READ4() ) == -1 )
p_ec->ppsz_value[i] = NULL;
} }
else if( i_type == 4 ) else if( i_type == 4 )
{ {
/* QWord */ /* QWord */
asprintf( &p_ec->ppsz_value[i], "%"PRId64, ASF_READ8() ); if( asprintf( &p_ec->ppsz_value[i], "%"PRId64, ASF_READ8() ) == -1 )
p_ec->ppsz_value[i] = NULL;
} }
else if( i_type == 5 ) else if( i_type == 5 )
{ {
/* Word */ /* Word */
asprintf( &p_ec->ppsz_value[i], "%d", ASF_READ2() ); if( asprintf( &p_ec->ppsz_value[i], "%d", ASF_READ2() ) == -1 )
p_ec->ppsz_value[i] = NULL;
} }
else else
{ {
......
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