[vlc-devel] Re: Am i going mad??

Nikos Antonopoulos nantonop at orbitech.gr
Fri Apr 20 13:36:29 CEST 2007


Fair point, although i can't really see why you'd want to do that and 
not simply use

p_val->psz_string = strdup(f);

as you suggest..

this is obviously me being daft but...

thanks!

Kenneth Østby wrote:
> Hi,
>
> On 4/20/07, *Nikos Antonopoulos* <nantonop at orbitech.gr 
> <mailto:nantonop at orbitech.gr>> wrote:
>
>
>     static void DupString( vlc_value_t *p_val ) { p_val->psz_string =
>     strdup( p_val->psz_string ); }
>
>
>     surely this is nothing but a small memleak... or is it???
>
>
>
>  Well, without knowing its specific function, it doesn't have to memleak.
>
> Consider the following bit of code:
>
> char *f = "hello world";
> p_val->psz_string = f;
>
> DupString(p_val);
>
> free(f);
> f = NULL;
>
> It can be quite useful at times if you don't want to :
> p_val->psz_string = strdup(f);
>
>
> Kenneth 

-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html



More information about the vlc-devel mailing list