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

Rémi Denis-Courmont remi at remlab.net
Tue Aug 3 11:17:06 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.

-- 
Rémi Denis-Courmont
http://www.remlab.net
http://fi.linkedin.com/in/remidenis




More information about the vlc-devel mailing list