Re: [Vimprobable-users] [PATCH] Possible fix for crash on :echo
Vimprobable is a lean web browser optimised for full keyboard control
Brought to you by:
hanness
|
From: Hannes S. <ha...@yl...> - 2011-09-16 14:02:40
|
Daniel Carl <dan...@gm...> wrote: > On Fri, Sep 16, 2011 at 03:25:22PM +0200, Hannes Sch__ller wrote: > > Please, no asymmetric freeing anymore! This lead to a lot of > > seemingly unrelated issues in the past. > > What's ment by assymetric feeing, freeing memory where it isn't > mallo()d? The script function frees memory that it hasn't malloc()d. > Then the script function should not free arg->s, but it does. What > was the reason to free arg->s in the script function? The reason, and feel free to correct me, was roughly "we cannot be bothered to track down all calling instances and free the memory there, so let's just do it in this central function". Which lead to all kinds of nasty race conditions in several less used functions. In your original patch, what I'd suggest to to allocate the memory, call the function and then free the memory again afterwards. Nice and readable. If we want to be sure, a "safefree" macro as suggested certainly will not hurt. Hannes |