summaryrefslogtreecommitdiffstats
path: root/src/msgb.c
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2018-03-08 21:35:48 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2018-03-09 04:07:51 +0700
commitb42330516f0aa4bdbbef03ad98555498ec16a715 (patch)
tree74386a8e49e0f33878f347486c50c8c875bb1439 /src/msgb.c
parent68b1e8e99c9f5acea52ecf3c8c5aa562ef9ccaa6 (diff)
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
Diffstat (limited to 'src/msgb.c')
-rw-r--r--src/msgb.c4
1 files changed, 3 insertions, 1 deletions
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 <osmocom/core/msgb.h>
#include <osmocom/core/talloc.h>
+#include <osmocom/core/logging.h>
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;
}