<p>Neels Hofmeyr has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/9953">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">add osmo_xua_msg_tall_ctx_init()<br><br>So far the tall_xua ctx used to allocate from in xua_msg_alloc() was never<br>initialized, actually hiding memory leaks from the talloc report.<br>Add this API to allow branching the xua_msg ctx off a sane root ctx.<br><br>Explicitly initialize tall_xua to NULL, so that, if xua_msg_ctx_init() isn't<br>called, tall_xua is still guaranteed to not be a random pointer.<br><br>The convention should actually be that only libosmocore exposes API with the<br>osmo_ prefix, but libosmo-sigtran explicitly exposes only symbols starting with<br>osmo_, forcing me to use this prefix.<br><br>osmo-bsc will use this function to hook the tall_xua ctx to osmo-bsc's own root<br>ctx.<br><br>Change-Id: I618878680a096a7f7fc2d83098590f2e4cb08870<br>---<br>M include/osmocom/sigtran/xua_msg.h<br>M src/xua_msg.c<br>2 files changed, 9 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/53/9953/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/sigtran/xua_msg.h b/include/osmocom/sigtran/xua_msg.h</span><br><span>index 423adbc..e912e02 100644</span><br><span>--- a/include/osmocom/sigtran/xua_msg.h</span><br><span>+++ b/include/osmocom/sigtran/xua_msg.h</span><br><span>@@ -69,6 +69,8 @@</span><br><span> extern const struct xua_dialect xua_dialect_sua;</span><br><span> extern const struct xua_dialect xua_dialect_m3ua;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+void osmo_xua_msg_tall_ctx_init(void *ctx);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> struct xua_msg *xua_msg_alloc(void);</span><br><span> void xua_msg_free(struct xua_msg *msg);</span><br><span> </span><br><span>diff --git a/src/xua_msg.c b/src/xua_msg.c</span><br><span>index d56009f..ed0cdc7 100644</span><br><span>--- a/src/xua_msg.c</span><br><span>+++ b/src/xua_msg.c</span><br><span>@@ -33,7 +33,13 @@</span><br><span> #include <string.h></span><br><span> #include <errno.h></span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static void *tall_xua;</span><br><span style="color: hsl(120, 100%, 40%);">+static void *tall_xua = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/* Allocate the root talloc context used for xua_msg_alloc(). */</span><br><span style="color: hsl(120, 100%, 40%);">+void osmo_xua_msg_tall_ctx_init(void *ctx)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+       tall_xua = talloc_named_const(ctx, 0, "xua_msg");</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span> </span><br><span> struct xua_msg *xua_msg_alloc(void)</span><br><span> {</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/9953">change 9953</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/9953"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmo-sccp </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I618878680a096a7f7fc2d83098590f2e4cb08870 </div>
<div style="display:none"> Gerrit-Change-Number: 9953 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>