<p>fixeria <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-pcu/+/16018">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  laforge: Looks good to me, but someone else must approve
  fixeria: Looks good to me, approved
  Jenkins Builder: Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">gprs_bssgp_destroy(): fix memleak and NULL-pointer dereference<br><br>So far there was a memory leak, because free()ing 'the_pcu.bctx'<br>would cause ASAN to complain. And that's reasonable, because it<br>needs to be freed properly. Moreover, 'the_pcu.bctx' may simply<br>be uninitialized in some cases, e.g. when OsmoPCU is terminated<br>before connecting to the SGSN.<br><br>Let's use the new bssgp_bvc_ctx_free() from libosmogb.<br><br>Change-Id: I274e79e1746c7678b81720ec11e8a564befe38ba<br>Depends: Ia78979379dbdccd6e4628c16f00d0c06d9212172<br>---<br>M src/gprs_bssgp_pcu.cpp<br>1 file changed, 1 insertion(+), 6 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp</span><br><span>index dd9eb68..914afc0 100644</span><br><span>--- a/src/gprs_bssgp_pcu.cpp</span><br><span>+++ b/src/gprs_bssgp_pcu.cpp</span><br><span>@@ -971,12 +971,7 @@</span><br><span> </span><br><span>  gprs_ns_destroy(nsi);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-       /* FIXME: move this to libgb: btsctx_free() */</span><br><span style="color: hsl(0, 100%, 40%);">-  llist_del(&the_pcu.bctx->list);</span><br><span style="color: hsl(0, 100%, 40%);">-#warning "This causes ASAN to complain. It is not critical for normal operation but should be fixed nevertheless"</span><br><span style="color: hsl(0, 100%, 40%);">-#if 0</span><br><span style="color: hsl(0, 100%, 40%);">-  talloc_free(the_pcu.bctx);</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span style="color: hsl(120, 100%, 40%);">+      bssgp_bvc_ctx_free(the_pcu.bctx);</span><br><span>    the_pcu.bctx = NULL;</span><br><span> }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-pcu/+/16018">change 16018</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/c/osmo-pcu/+/16018"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-pcu </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I274e79e1746c7678b81720ec11e8a564befe38ba </div>
<div style="display:none"> Gerrit-Change-Number: 16018 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: fixeria <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: fixeria <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>