diff options
author | Thomas Graf <tgraf@suug.ch> | 2014-08-24 22:11:32 +0200 |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2014-08-24 22:11:32 +0200 |
commit | 9d89c5bc8e9ae07edb325a7df91daac41c43e958 (patch) | |
tree | d77868a35d0b3191ae7086cc01ea41aedade8b7d | |
parent | 584ef44252527c2e5decd45df325e62a591de55e (diff) |
curses: Handle out of memory return value of of vasprintf()fixes
Signed-off-by: Thomas Graf <tgraf@suug.ch>
-rw-r--r-- | src/out_curses.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/out_curses.c b/src/out_curses.c index df50f1d..cbd19ae 100644 --- a/src/out_curses.c +++ b/src/out_curses.c @@ -172,7 +172,10 @@ static void center_text(const char *fmt, ...) unsigned int col; 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); col = (cols / 2) - (strlen(str) / 2); |