Wireshark-dev: Re: [Wireshark-dev] [PATCH] Re: Freeing memory of se_alloc'ated object
Date: Mon, 2 May 2011 17:09:18 +0200
On Mon, May 02, 2011 at 02:12:39AM +0400, Max wrote:
> it costs one additional pointer per each memory chunk allocated.

Actually why dtor member is inside emem_chunk_t struct? and not inside emem_header_t? :>

> I would gladly read you comments, critics and suggestions regarding this patch.

It seems that you put dtor data before canary, and you execute dtors before checking one.
Buffer overflows can lead to executing code from given pointer.

About API I'd prefer smth like: se_register_gc_dtor(void *ptr, emem_dtor_cb dtor)
which would register already allocated ptr.

(+) It'd work with any se_* allocated memory.
(+) you can register it any time (not only at allocation)
(-) you should check if ptr is valid pointer (se_verify_pointer())