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: Eli Zaretskii
Subject: Re: [bug-gawk] Bugs in Gawk
Date: Sat, 22 Mar 2014 16:59:45 +0200

> 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]