[PATCH] 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/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Thu Mar 8 19:39:38 UTC 2018


Review at  https://gerrit.osmocom.org/7164

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(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/64/7164/1

diff --git a/src/msgb.c b/src/msgb.c
index f79a634..1aecd57 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>
 
 static 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: newchange
Gerrit-Change-Id: I3e2d1beabd6936fc28a1ad664c083ff1698bb644
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>



More information about the gerrit-log mailing list