aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2019-11-09 01:57:17 +0700
committerfixeria <axilirator@gmail.com>2019-11-10 09:04:21 +0000
commit0bf622e0573ae44b90f14a0bbc2a9ef21f5bf457 (patch)
tree3f602bac849640f0cf6f8cae1613d6997650eba9
parentfd734de4d176420199d8badb9262329dc0603780 (diff)
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
-rw-r--r--src/gprs_bssgp_pcu.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index dd9eb686..914afc07 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -971,12 +971,7 @@ void gprs_bssgp_destroy(void)
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;
}