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

Fix memleaks: EnsureUTF8 return NULL if the string isn't valid,

so we must be able to free the memory in this case.
parent a7bb5dff
......@@ -850,7 +850,10 @@ static int ReadICYMeta( access_t *p_access )
strcmp( p_sys->psz_icy_title, &p[1] ) )
{
free( p_sys->psz_icy_title );
p_sys->psz_icy_title = EnsureUTF8( strdup( &p[1] ));
char *psz_tmp = strdup( &p[1] );
p_sys->psz_icy_title = EnsureUTF8( psz_tmp );
if( !p_sys->psz_icy_title )
free( psz_tmp );
p_access->info.i_update |= INPUT_UPDATE_META;
msg_Dbg( p_access, "New Title=%s", p_sys->psz_icy_title );
......@@ -1432,7 +1435,10 @@ static int Request( access_t *p_access, int64_t i_tell )
else if( !strcasecmp( psz, "Icy-Name" ) )
{
free( p_sys->psz_icy_name );
p_sys->psz_icy_name = EnsureUTF8( strdup( p ));
char *psz_tmp = strdup( p );
p_sys->psz_icy_name = EnsureUTF8( psz_tmp );
if( !p_sys->psz_icy_name )
free( psz_tmp );
msg_Dbg( p_access, "Icy-Name: %s", p_sys->psz_icy_name );
p_sys->b_icecast = true; /* be on the safeside. set it here as well. */
......@@ -1442,7 +1448,10 @@ static int Request( access_t *p_access, int64_t i_tell )
else if( !strcasecmp( psz, "Icy-Genre" ) )
{
free( p_sys->psz_icy_genre );
p_sys->psz_icy_genre = EnsureUTF8( strdup( p ));
char *psz_tmp = strdup( p );
p_sys->psz_icy_genre = EnsureUTF8( psz_tmp );
if( !p_sys->psz_icy_genre )
free( psz_tmp );
msg_Dbg( p_access, "Icy-Genre: %s", p_sys->psz_icy_genre );
}
else if( !strncasecmp( psz, "Icy-Notice", 10 ) )
......
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