[vlc-devel] [PATCH] V4L2: Allow device to be specified with option.

Thierry Reding thierry.reding at avionic-design.de
Wed Apr 20 11:15:43 CEST 2011


* Rémi Denis-Courmont wrote:
>    Hello,
> 
> On Wednesday 20 April 2011, Thierry Reding wrote:
> > Nothing that hasn't been there before. Although looking at it more closely,
> > p_sys->psz_device is free()'d in CommonClose(), so that is not a leak.
> > However it seems like an additional strdup() is required after the call to
> > var_CreateGetNonEmptyString(), otherwise the variable's value will be
> > free()'d twice. Then again I haven't seen any crashes.
> > 
> > Am I overlooking something?
> 
> If I understand the code, previously, p_sys->psz_device would always be NULL 
> at that point.  Now, you seem to override a possibly non-NULL pointer with 
> another one. Then the original pointer is leaked ??

Right. Except that var_CreateGetNonEmptyString() doesn't strdup() the
returned value, so this wouldn't leak anything. But it seems like it will
cause psz_device to be double-free()'d. I will follow up with another patch.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20110420/bceddb2b/attachment.sig>


More information about the vlc-devel mailing list