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

Avoid duplicate memory allocation

parent a9ac3e9e
......@@ -393,9 +393,8 @@ static int ReadDir( playlist_t *p_playlist, const char *psz_name,
{
const char *entry = pp_dir_content[i];
int i_size_entry = strlen( psz_name ) +
strlen( entry ) + 2;
strlen( entry ) + 2 + 7 /* strlen("file://") */;
char psz_uri[i_size_entry];
char psz_mrl[i_size_entry + 7]; /* "file://psz_uri" */
sprintf( psz_uri, "%s/%s", psz_name, entry);
......@@ -472,9 +471,10 @@ static int ReadDir( playlist_t *p_playlist, const char *psz_name,
}
}
sprintf( &psz_mrl, "file://%s", psz_uri );
memmove (psz_uri + 7, psz_uri, sizeof (psz_uri) - 7);
memcpy (psz_uri, "file://", 7);
p_input = input_ItemNewWithType( VLC_OBJECT(p_playlist),
psz_mrl, entry, 0, NULL,
psz_uri, entry, 0, NULL,
-1, ITEM_TYPE_VFILE );
if (p_input != NULL)
{
......
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