curses: Handle out of memory return value of of vasprintf()
Signed-off-by: Thomas Graf <tgraf@suug.ch>
This commit is contained in:
parent
584ef44252
commit
9d89c5bc8e
@ -172,7 +172,10 @@ static void center_text(const char *fmt, ...)
|
|||||||
unsigned int col;
|
unsigned int col;
|
||||||
|
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
vasprintf(&str, fmt, args);
|
if (vasprintf(&str, fmt, args) < 0) {
|
||||||
|
fprintf(stderr, "vasprintf: Out of memory\n");
|
||||||
|
exit(ENOMEM);
|
||||||
|
}
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
col = (cols / 2) - (strlen(str) / 2);
|
col = (cols / 2) - (strlen(str) / 2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user