From b42330516f0aa4bdbbef03ad98555498ec16a715 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Thu, 8 Mar 2018 21:35:48 +0700 Subject: src/msgb.c: print an error if msgb allocation failed Printing an error message when msgb allocation failed was initially intended, but have been commented out for years. This would facilitate the bug hunting process, especially on embedded platforms with limited resources (e.g. amount of RAM). The GLOBAL logging subsystem with FATAL level is used for printing such messages. Change-Id: I3e2d1beabd6936fc28a1ad664c083ff1698bb644 --- src/msgb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/msgb.c b/src/msgb.c index 9efaea56..82902b40 100644 --- a/src/msgb.c +++ b/src/msgb.c @@ -62,6 +62,7 @@ #include #include +#include void *tall_msgb_ctx = NULL; @@ -81,7 +82,8 @@ struct msgb *msgb_alloc(uint16_t size, const char *name) msg = _talloc_zero(tall_msgb_ctx, sizeof(*msg) + size, name); if (!msg) { - //LOGP(DRSL, LOGL_FATAL, "unable to allocate msgb\n"); + LOGP(DLGLOBAL, LOGL_FATAL, "Unable to allocate a msgb: " + "name='%s', size=%u\n", name, size); return NULL; } -- cgit v1.2.3