Commit cc6941a5 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Fix memory leak and error handling

parent 8cb6c0e6
......@@ -274,26 +274,31 @@ static int InitVideo(decoder_t *p_dec)
"\0"
};
for( size_t i = 0; psz_paths[i]; i += strlen( psz_paths[i] ) + 1 )
for( size_t i = 0; psz_paths[i]; i += strlen( psz_paths + i ) + 1 )
{
asprintf( &g_decode_path, "%s/drv4.so.6.0", psz_paths + i );
if( (p_sys->rv_handle = load_syms_linux(p_dec, g_decode_path)) )
if( asprintf( &g_decode_path, "%s/drv4.so.6.0", psz_paths + i ) != -1 )
{
b_so_opened = true;
p_sys->rv_handle = load_syms_linux(p_dec, g_decode_path);
free( g_decode_path );
}
if( p_sys->rv_handle )
{
b_so_opened = true;
break;
}
asprintf( &g_decode_path, "%s/drv3.so.6.0", psz_paths + i );
if( (p_sys->rv_handle = load_syms_linux(p_dec, g_decode_path)) )
if( asprintf( &g_decode_path, "%s/drv3.so.6.0", psz_paths + i ) != -1 )
{
b_so_opened = true;
p_sys->rv_handle = load_syms_linux(p_dec, g_decode_path);
free( g_decode_path );
}
if( p_sys->rv_handle )
{
b_so_opened = true;
break;
}
msg_Dbg( p_dec, "Cannot load real decoder library: %s", g_decode_path);
free( g_decode_path );
}
#endif
......
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