[PATCH] Erase memory before freeing.

Ben Kibbey bjk at luxsci.net
Fri Aug 5 00:20:09 CEST 2016


On Tue, Aug 02, 2016 at 09:51:42AM +0200, Justus Winter wrote:
 
> Actually, if you allocate both the length and the actual data in one
> chunk, you don't need an extra data structure at all and get constant
> time lookups, i.e.:
> 
> struct chunk {
> size_t size;
> char data[0];
> };
> 
> then on free(p) you do
> 
> chunk *c = p - offsetof(struct chunk, data);

Thanks for the info. Good to know. I wonder how much faster it is. I'll
do a benchmark sometime to see.

-- 
Ben Kibbey



More information about the Gnupg-devel mailing list