xcalloc called from signal handler

Daniel Stone daniel at fooishbar.org
Sun Dec 16 16:36:27 PST 2007


On Sun, Dec 16, 2007 at 06:48:09PM -0500, Bernardo Innocenti wrote:
> Matthieu Herrb wrote:
> > Unfortunalty the xserver 1.4 new Xinput code calls xcalloc() in
> > functions that are called by the SIGIO handler. This has been identified
> > as the cause of many X server segfaults on OpenBSD, and will probably
> > also cause random problems on other systems.
> 
> I've observed such problems on Linux too, when you try to quit the X server
> through SIGINT.

Feel free to file bugs (or, better, send patches) for malloc() on exit
or in signal handlers.

> + /* Preallocate xEvent store */
> + if (!xf86Events)
> + 	xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
> + if (!xf86Events)
> + 	FatalError("Couldn't allocate event store\n"); 
> 
> The error message is never going to show up because xcalloc() is
> supposed to automatically abort() on failure.

Er, in which parallel universe?

_X_EXPORT void *
Xcalloc(unsigned long amount)
{
    unsigned long   *ret;

    ret = Xalloc (amount);
    if (ret)
        bzero ((char *) ret, (int) amount);
    return ret;
}

Cheers,
Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg/attachments/20071217/6fd22133/attachment.pgp>


More information about the xorg mailing list