exit when calloc failes

This commit is contained in:
Sascha Kruse 2012-07-13 10:03:57 +02:00
parent df0e986ba3
commit f983ba1b2a

4
draw.c
View File

@ -156,8 +156,10 @@ unsigned long getcolor(DC * dc, const char *colstr)
ColorSet *initcolor(DC * dc, const char *foreground, const char *background) ColorSet *initcolor(DC * dc, const char *foreground, const char *background)
{ {
ColorSet *col = (ColorSet *) malloc(sizeof(ColorSet)); ColorSet *col = (ColorSet *) malloc(sizeof(ColorSet));
if (!col) if (!col) {
eprintf("error, cannot allocate memory for color set"); eprintf("error, cannot allocate memory for color set");
exit(EXIT_FAILURE);
}
col->BG = getcolor(dc, background); col->BG = getcolor(dc, background);
col->FG = getcolor(dc, foreground); col->FG = getcolor(dc, foreground);
if (dc->font.xft_font) if (dc->font.xft_font)