exit when calloc failes
This commit is contained in:
parent
df0e986ba3
commit
f983ba1b2a
4
draw.c
4
draw.c
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user