[vlc-devel] [PATCH] DVB-S scanning support

Rémi Duraffort ivoire at videolan.org
Tue Aug 3 13:31:58 CEST 2010


> On Tue, 3 Aug 2010 12:13:19 +0300, David Kaplan <david at 2of1.org> wrote:
> > On Tue, Aug 3, 2010 at 12:11 PM, Rémi Duraffort <ivoire at videolan.org>
> > wrote:
> > 
> >> > > > +    if( p_scan->parameter.type == SCAN_DVB_S )
> >> > > > +        /* set satellite config file path */
> >> > > > +        strncpy( p_scan->parameter.sat_info.psz_name,
> >> > > > +                 var_GetString( p_access, "dvb-satellite" ),
> >> > > > +                 sizeof(p_scan->parameter.sat_info.psz_name) );
> >> > >
> >> > > Memory leak.
> >> > >
> >> >
> >> > Where's it leaking? .psz_name is allocated on the heap.
> >> var_GetString allocate the memory needed for the string (strdup) so you
> >> are leaking here.
> >>
> > 
> > Ahh ok. didn't realise it did a strdup (just thought it passed a ptr to
> > the string).
> 
> It would be nice not to care about memory allocation. But I do not see how
> that could work. Keep in mind another thread can always change the
> variable's value asynchronously.
Or we can add a var_Lock("my_var") to get a pointer to the const char
without strdup (but that's really dangerous IMHO : too many bad-usages).


Best regards

-- 
Rémi Duraffort | ivoire



More information about the vlc-devel mailing list