summaryrefslogtreecommitdiffstats
path: root/common/console_common.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-06-09 09:26:44 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-06-09 09:26:44 +0200
commit7a429bfb3b11a4af5ab0a328a22c354b3838a7a7 (patch)
treeba8f6854c8a267c1ea6a5a591456de52ca45e02e /common/console_common.c
parent760e652a7aca15c3ba67f3e7ad4488d49f7a629a (diff)
parent79eba3029f330682d9ba1f5d248720c761de14a7 (diff)
downloadbarebox-7a429bfb3b11a4af5ab0a328a22c354b3838a7a7.tar.gz
Merge branch 'for-next/misc'
Diffstat (limited to 'common/console_common.c')
-rw-r--r--common/console_common.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/common/console_common.c b/common/console_common.c
index 1e362ab..2c82c6f 100644
--- a/common/console_common.c
+++ b/common/console_common.c
@@ -106,15 +106,23 @@ static void pr_puts(int level, const char *str)
log_clean(barebox_log_max_messages - 1);
if (barebox_log_max_messages >= 0) {
- log = xzalloc(sizeof(*log));
- log->msg = xstrdup(str);
+ log = malloc(sizeof(*log));
+ if (!log)
+ goto nolog;
+
+ log->msg = strdup(str);
+ if (!log->msg) {
+ free(log);
+ goto nolog;
+ }
+
log->timestamp = get_time_ns();
log->level = level;
list_add_tail(&log->list, &barebox_logbuf);
barebox_logbuf_num_messages++;
}
}
-
+nolog:
if (level > barebox_loglevel)
return;