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/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Review at https://gerrit.osmocom.org/4076
IPA msgb: on ipa_msg_alloc(), set caller as talloc string
Upon talloc, instead of "IPA Multiplex", actually use the calling function as
talloc string:
- add ipa_msg_alloc2(), which takes a talloc name as argument.
- make ipa_msg_alloc() a macro that calls ipa_msg_alloc2() passing __func__ as
string.
Future callers may invoke ipa_msg_alloc2() directly and provide a talloc
string. All current callers now produce a talloc string that indicates exactly
which caller created the msgb.
This was useful to find a memory leak in OsmoMSC, see OS#2476.
Change-Id: Ic67ca94b27a4f36ba1bf655b4cd1c7e78fd06ab8
---
M include/osmocom/gsm/ipa.h
M src/gsm/ipa.c
M src/gsm/libosmogsm.map
3 files changed, 5 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/4076/1
diff --git a/include/osmocom/gsm/ipa.h b/include/osmocom/gsm/ipa.h
index 7e1d723..d2c27fa 100644
--- a/include/osmocom/gsm/ipa.h
+++ b/include/osmocom/gsm/ipa.h
@@ -70,7 +70,8 @@
/* prepend (push) an ipaccess_head to the msgb */
void ipa_prepend_header(struct msgb *msg, int proto);
-struct msgb *ipa_msg_alloc(int headroom);
+#define ipa_msg_alloc(headroom) ipa_msg_alloc2((headroom), __func__)
+struct msgb *ipa_msg_alloc2(int headroom, const char *msgb_name);
int ipa_msg_recv(int fd, struct msgb **rmsg);
int ipa_msg_recv_buffered(int fd, struct msgb **rmsg, struct msgb **tmp_msg);
diff --git a/src/gsm/ipa.c b/src/gsm/ipa.c
index fef73c3..2ef513c 100644
--- a/src/gsm/ipa.c
+++ b/src/gsm/ipa.c
@@ -576,13 +576,13 @@
#endif /* SYS_SOCKET_H */
-struct msgb *ipa_msg_alloc(int headroom)
+struct msgb *ipa_msg_alloc2(int headroom, const char *msgb_name)
{
struct msgb *nmsg;
headroom += sizeof(struct ipaccess_head);
- nmsg = msgb_alloc_headroom(1200 + headroom, headroom, "IPA Multiplex");
+ nmsg = msgb_alloc_headroom(1200 + headroom, headroom, msgb_name);
if (!nmsg)
return NULL;
return nmsg;
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index 066f410..54b61a4 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -398,7 +398,7 @@
ipa_ccm_idtag_parse_off;
ipa_ccm_make_id_resp;
ipa_ccm_make_id_resp_from_req;
-ipa_msg_alloc;
+ipa_msg_alloc2;
ipa_msg_recv;
ipa_msg_recv_buffered;
ipa_parse_unitid;
--
To view, visit https://gerrit.osmocom.org/4076
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic67ca94b27a4f36ba1bf655b4cd1c7e78fd06ab8
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>