die when calloc failes

This commit is contained in:
Sascha Kruse 2012-07-13 09:51:31 +02:00
parent ec8f3f6413
commit afc5a8a5dc

5
draw.c
View File

@ -176,8 +176,11 @@ DC *initdc(void)
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
fputs("no locale support\n", stderr);
if (!(dc = calloc(1, sizeof *dc)))
if (!(dc = calloc(1, sizeof *dc))) {
eprintf("cannot malloc %u bytes:", sizeof *dc);
exit(EXIT_FAILURE);
}
if (!(dc->dpy = XOpenDisplay(NULL)))
eprintf("cannot open display\n");