mirror of https://gerrit.osmocom.org/libosmocore
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
This commit is contained in:
parent
68b1e8e99c
commit
b42330516f
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue