[MERGED] libosmocore[master]: src/msgb.c: print an error if msgb allocation failed

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Mar 9 12:04:10 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: src/msgb.c: print an error if msgb allocation failed
......................................................................


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
---
M src/msgb.c
1 file changed, 3 insertions(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/msgb.c b/src/msgb.c
index 9efaea5..82902b4 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 @@
 	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;
 	}
 

-- 
To view, visit https://gerrit.osmocom.org/7164
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3e2d1beabd6936fc28a1ad664c083ff1698bb644
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list