[PATCH 2/6] xserver: Possible memory leaks, stricter option checks, UnInit (NewInputDeviceRequest)

Christoph Hellwig hch at lst.de
Sat Mar 31 02:42:04 PDT 2007

On Sat, Mar 31, 2007 at 12:13:10AM +0200, Magnus Vigerl?f wrote:
> Can the xserver really start using the standard C library methods? I'm not so 
> sure as the Xalloc do some really nifty things (mmap) for big allocations, 
> and I do think they are needed to be kept like that.

At glibc uses mmap for malloc when it's beneficial aswell.

> I didn't thought of that specific case.. But I'm not sure how big loss that 
> would be.. If there's only one pointer and that is null, then there's no 
> problem unless the freed memory is accessed where we'll get a SEGV instead of 
> (potentially) something fishy. The most common problem with double free is 
> (in my experience) two different structures that holds a pointer to the same 
> memory and in this case if the memory is freed from both structures we'll 
> still have a double free with or without setting the pointer to NULL.

Exactly.  What's much more helpful is to set the freed memory to a
poisoning pattern so that you can detect use after frees, the actual
pointer shouldn't be much of an issue.

More information about the xorg mailing list