Web lists-archives.com

Re: g_error_free() warning on null pointer

Allin Cottrell wrote:
> On the one hand, the function is question is specialized, it's not
> free(), nor g_free(), and no standard mandates that it should accept a
> NULL pointer as a no-op.

Agreed. I wasn't suggesting that it's officially specified. I just think
that this aspect of free() is intentional and useful, and that people
have a reasonable expectation that g_error_free() will conform. This
probably applies to other free()-like functions as well (I'm very new to

> On the other hand, if this function in fact accepts a NULL without
> error it's perverse that it should make a fuss about it. It seems to
> me that by far the most likely case of g_error_free() getting a NULL
> argument is a coder expecting NULL -> no-op semantics by analogy with
> C's free(). What sort of bug would you have in mind?
gtk-devel-list mailing list