Yep, according to comments on ocstr.h:

 *      octstr_search(os, octstr_imm("foo"), 0)
 *
 * The above looks like a memory leak, but it is not. Each immutable
 * octet string (i.e., with the same C string literal pointer) is really 
 * created only the first time, and octstr_destroy won't destroy it,
 * either. The immutable octet strings are destroyed automatically when
 * the process ends.

Regards,

Alex
--
Alejandro Guerrieri
[email protected]



On 01/07/2010, at 13:06, Rene Kluwen wrote:

> Ah... I didn't know that cfg_get was sending a duplicate.
> Nonetheless, the possible immutable shouldn't be destroyed. But I think that
> octstr_destroy will take that into account.
> 
> == Rene
> 
> -----Original Message-----
> From: Alexander Malysh [mailto:[email protected]] On Behalf Of
> Alexander Malysh
> Sent: woensdag 30 juni 2010 10:47
> To: Rene Kluwen
> Cc: [email protected]
> Subject: Re: [PATCH] dlr.c
> 
> Hi,
> 
> -1 because you are wrong:
> Octstr *cfg_get_real(CfgGroup *grp, Octstr *varname, const char *file,
>                     long line, const char *func)
> {
>    Octstr *os;
> 
>    if(grp == NULL)
>        panic(0, "Trying to fetch variable `%s' in non-existing group",
>              octstr_get_cstr(varname));
> 
>    if (grp->name != NULL && !is_allowed_in_group(grp->name, varname))
>        panic(0, "Trying to fetch variable `%s' in group `%s', not
> allowed.",
>              octstr_get_cstr(varname), octstr_get_cstr(grp->name));
> 
>    os = dict_get(grp->vars, varname);
>    if (os == NULL)
>        return NULL;
>    return gw_claim_area_for(octstr_duplicate(os), file, line, func);
> }
> 
> Thanks,
> Alexander Malysh
> 
> Am 29.06.2010 um 20:43 schrieb Rene Kluwen:
> 
>> The octstr_destroy(dlr_type); in dlr.c is a bug. It shouldn't be there,
>> since dlr_type is either an immutable or a string got from cfg_get.
>> 
>> == Rene
>> <dlr_bug.diff>
> 
> 
> 
> 


Reply via email to