<p>This code-path shouldn’t be invoked too often, and as such the current implementation is borderline premature optimization (in my opinion).</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<p>diff –git a/lib/media.c b/lib/media.c index 0b20aaa..74c9c3b 100644 — a/lib/media.c +++ b/lib/media.c @@ -1189,6 +1189,7 @@ unsigned int libvlc_media_slaves_get( libvlc_media_t <em>p_md, libvlc_media_slaves_release(pp_slaves, i); return vlc_mutex_unlock( &p_input_item->lock ), 0; } + p_slave->psz_uri = (char </em>) ((uint8_t <em>)p_slave) + sizeof(</em>p_slave); strcpy( p_slave->psz_uri, p_item_slave->psz_uri );</p>
</blockquote>
<p>I would prefer a separate memory-allocation for the contents being pointed to by <code>p_slave->psz_uri</code>, rather than allocating enough memory for the <code>libvlc_media_slave_t</code> + the length of the uri-data (which is effectively a simulation of flexible arrays, without using such).</p>
<p>Having <code>p_slave->psz_uri = strdup( p_item_slave->psz_uri )</code> aids readability, and a separate <code>free( p_slave->psz_uri )</code> during slave clean-up shouldn’t be too intrusive.</p>