Forum: Ruby-Gnome 2 I applied a patch to fix all the list *_free functions

Posted by Nikolai Weibull (Guest)
on 2010-07-23 18:55
(Received via mailing list)
I applied a patch to fix all the list *_free functions.

These functions were horribly broken.  Not only could they fail to
release the memory if an error occurred, they never actually freed the
memory even if everything succeeded!  The argument variable was
reused, so when, for example, g_list_free was actually called, the
argument would be NULL.
Posted by Kouhei Sutou (Guest)
on 2010-07-24 01:39
(Received via mailing list)
Hi,

In <AANLkTi=3H=0rkGbOcwR1=PrGHKe0ttsGBU-fkN15bJ4i@mail.gmail.com>
  "[ruby-gnome2-devel-en] I applied a patch to fix all the list *_free 
functions" on Fri, 23 Jul 2010 18:55:03 +0200,
  Nikolai Weibull <now@bitwi.se> wrote:

> I applied a patch to fix all the list *_free functions.
> 
> These functions were horribly broken.  Not only could they fail to
> release the memory if an error occurred, they never actually freed the
> memory even if everything succeeded!  The argument variable was
> reused, so when, for example, g_list_free was actually called, the
> argument would be NULL.

It seems that rbgutil_glist2ary_string_and_free() doesn't
free list data when it gets an error while processing.

e.g.:

  list: ("a", "b", "c")
  error on "b":
    * "c" will not be freed. ("b" may not be freed?)
    * list will be freed.

Thanks,
--
kou
Posted by Nikolai Weibull (Guest)
on 2010-07-24 10:40
(Received via mailing list)
On Sat, Jul 24, 2010 at 01:39, Kouhei Sutou <kou@cozmixng.org> wrote:

>  Nikolai Weibull <now@bitwi.se> wrote:

>> These functions were horribly broken.  Not only could they fail to
>> release the memory if an error occurred, they never actually freed the
>> memory even if everything succeeded!  The argument variable was
>> reused, so when, for example, g_list_free was actually called, the
>> argument would be NULL.
>
> It seems that rbgutil_glist2ary_string_and_free() doesn't
> free list data when it gets an error while processing.

You’re correct.  I’ve committed a fix.  Thanks!
Posted by Kouhei Sutou (Guest)
on 2010-07-25 05:00
(Received via mailing list)
Hi,

In <AANLkTinrcf2y=3ZYe5orEBad+pawfG2B0g7kB1wTxBFJ@mail.gmail.com>
  "Re: [ruby-gnome2-devel-en] I applied a patch to fix all the list 
*_free functions" on Sat, 24 Jul 2010 10:39:55 +0200,
  Nikolai Weibull <now@bitwi.se> wrote:

>> It seems that rbgutil_glist2ary_string_and_free() doesn't
>> free list data when it gets an error while processing.
> 
> You¢re correct.  I¢ve committed a fix.  Thanks!

Thanks!
--
kou
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.