bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Bugs in Gawk


From: Flávio Medeiros
Subject: Re: [bug-gawk] Bugs in Gawk
Date: Sat, 22 Mar 2014 12:05:27 -0300

Yes, but when we have RE_ENABLE_I18N disabled, we have the following code:

if (BE (sbcset == NULL, 0)){
     re_free (sbcset);
     *err = REG_ESPACE;
     return NULL;
}

So, line *re_free (sbcset);* is executed only when sbcset is NULL.


Regards,
Flávio




On Sat, Mar 22, 2014 at 11:59 AM, Eli Zaretskii <address@hidden> wrote:
> Date: Sat, 22 Mar 2014 11:18:24 -0300
> From: Flávio Medeiros <address@hidden>
> Cc: address@hidden, address@hidden
>
> 01. sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
> 02. #ifdef RE_ENABLE_I18N
> 03.  mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1);
> 04. #endif /* RE_ENABLE_I18N */
> 05. #ifdef RE_ENABLE_I18N
> 06.  if (BE (sbcset == NULL || mbcset == NULL, 0))
> 07. #else
> 08.  if (BE (sbcset == NULL, 0))
> 09. #endif /* RE_ENABLE_I18N */
> 10.    {
> 11.      re_free (sbcset);
> 12. #ifdef RE_ENABLE_I18N
> 13.       re_free (mbcset);
> 14. #endif
> 15.       *err = REG_ESPACE;
> 16.     return NULL;
> 17.    }
>
> The developer adds lines 11, 12, 13, and 14. Okay, these lines avoid the
> memory leak in variables *mbcset* and *sbcset*. However, there is no reason
> to add line 11 outside the #ifdef code. When macro RE_ENABLE_I18N is not
> active, *sbcset* is always *NULL*.

No, sbcset is assigned a non-NULL value by the call to calloc in line
01, which is not conditioned on RE_ENABLE_I18N.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]