die when calloc failes
This commit is contained in:
parent
ec8f3f6413
commit
afc5a8a5dc
5
draw.c
5
draw.c
@ -176,8 +176,11 @@ DC *initdc(void)
|
|||||||
|
|
||||||
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
|
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
|
||||||
fputs("no locale support\n", stderr);
|
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);
|
eprintf("cannot malloc %u bytes:", sizeof *dc);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
if (!(dc->dpy = XOpenDisplay(NULL)))
|
if (!(dc->dpy = XOpenDisplay(NULL)))
|
||||||
eprintf("cannot open display\n");
|
eprintf("cannot open display\n");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user