Change in osmo-pcu[master]: gprs_bssgp_destroy(): fix memleak and NULL-pointer dereference

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/.

fixeria gerrit-no-reply at lists.osmocom.org
Sun Nov 10 09:04:21 UTC 2019


fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/16018 )

Change subject: gprs_bssgp_destroy(): fix memleak and NULL-pointer dereference
......................................................................

gprs_bssgp_destroy(): fix memleak and NULL-pointer dereference

So far there was a memory leak, because free()ing 'the_pcu.bctx'
would cause ASAN to complain. And that's reasonable, because it
needs to be freed properly. Moreover, 'the_pcu.bctx' may simply
be uninitialized in some cases, e.g. when OsmoPCU is terminated
before connecting to the SGSN.

Let's use the new bssgp_bvc_ctx_free() from libosmogb.

Change-Id: I274e79e1746c7678b81720ec11e8a564befe38ba
Depends: Ia78979379dbdccd6e4628c16f00d0c06d9212172
---
M src/gprs_bssgp_pcu.cpp
1 file changed, 1 insertion(+), 6 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  fixeria: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index dd9eb68..914afc0 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -971,12 +971,7 @@
 
 	gprs_ns_destroy(nsi);
 
-	/* FIXME: move this to libgb: btsctx_free() */
-	llist_del(&the_pcu.bctx->list);
-#warning "This causes ASAN to complain. It is not critical for normal operation but should be fixed nevertheless"
-#if 0
-	talloc_free(the_pcu.bctx);
-#endif
+	bssgp_bvc_ctx_free(the_pcu.bctx);
 	the_pcu.bctx = NULL;
 }
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/16018
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I274e79e1746c7678b81720ec11e8a564befe38ba
Gerrit-Change-Number: 16018
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191110/5bb07ce1/attachment.htm>


More information about the gerrit-log mailing list