Commit ef7820be authored by Filip Roséen's avatar Filip Roséen Committed by Rémi Denis-Courmont

input/item: input_item_AddOption: do not add NULL on error

Implementations querying p_input->ppsz_options rely on each entry not
being NULL, meaning that we shall not add such values to the array.

These changes make sure that we check whether the strdup was
successful, and return an error if it was not.
Signed-off-by: Rémi Denis-Courmont's avatarRémi Denis-Courmont <remi@remlab.net>
parent 1739ed0f
......@@ -559,11 +559,21 @@ int input_item_AddOption( input_item_t *p_input, const char *psz_option,
err = VLC_ENOMEM;
goto out;
}
p_input->optflagv = flagv;
flagv[p_input->optflagc++] = flags;
char* psz_option_dup = strdup( psz_option );
if( unlikely( !psz_option_dup ) )
{
err = VLC_ENOMEM;
goto out;
}
INSERT_ELEM( p_input->ppsz_options, p_input->i_options,
p_input->i_options, strdup( psz_option ) );
p_input->i_options, psz_option_dup );
flagv[p_input->optflagc++] = flags;
out:
vlc_mutex_unlock( &p_input->lock );
return err;
......
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