[Geany-Devel] [geany/geany-plugins] 4cc119: Scope: Fix mismatched allocator/deallocator

Colomban Wendling lists.ban at xxxxx
Thu Mar 7 20:03:53 UTC 2013

Le 07/03/2013 20:44, Lex Trotman a écrit :
> On 8 March 2013 06:06, Dimitar Zhekov <dimitar.zhekov at gmail.com> wrote:
>> On Mon, 04 Mar 2013 22:30:40 -0000
>> Colomban Wendling <git-noreply at geany.org> wrote:
>>> Log Message:
>>> -----------
>>> Scope: Fix mismatched allocator/deallocator
>> These are not mismatched, I'm using strdup() instead of strdup() for
>> strings that must never be NULL. Unless we have a policy to always
>> use g_strdup(), or there is a real g_/strdup vs. g_/free mismatch
>> somewhere, I'm going to revert them.
>> Personally I prefer offensive programming: if something goes wrong, let
>> it crash and burn, get a proper backtrace and fix it.
> In which case this plugin must be removed from G-P until you have a
> reasonable assurance it won't bring Geany down.  You may prefer crash
> and burn, but you should not impose that on innocent G-P users.

I don't think he was saying that his plugin will crash rather than
accept invalid input, but he prefers it to crash rather than pretend it
worked but use e.g. invalid memory.

And Geany itself uses GLib, which means that memory exhaustion, if
reported by the allocator, will lead to a abort() anyway, so I don't see
any problem not dealing with NULL in most cases (e.g. when doing normal
stuff, not allocating 4GB of RAM, in which case you not only should use
g_try_malloc() but also rethink your program :D)


More information about the Devel mailing list