pespin has uploaded this change for review.

View Change

osmux: Close osmux socket when bts is freed

Related: SYS#5987
Change-Id: Ibd3faa33b28d45048c340b177f13d5685f41a784
---
M src/common/osmux.c
1 file changed, 8 insertions(+), 3 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/76/29576/1
diff --git a/src/common/osmux.c b/src/common/osmux.c
index 498fe24..e8223ff 100644
--- a/src/common/osmux.c
+++ b/src/common/osmux.c
@@ -25,6 +25,7 @@
#include <stdint.h>
#include <stdbool.h>
#include <inttypes.h>
+#include <unistd.h>

#include <osmocom/core/logging.h>
#include <osmocom/core/utils.h>
@@ -288,14 +289,18 @@
bts->osmux.batch_size = OSMUX_BATCH_DEFAULT_MAX;
bts->osmux.dummy_padding = false;
INIT_LLIST_HEAD(&bts->osmux.osmux_handle_list);
+ bts->osmux.fd.fd = -1;
return 0;
}

void bts_osmux_release(struct gsm_bts *bts)
{
- /* FIXME: not needed? YES,we probably need to iterare over
- bts->osmux.osmux_handle_list and free everything there, see
- osmux_handle_put() */
+ /* bts->osmux.osmux_handle_list should end up empty when all lchans are
+ * released/freed upon talloc_free(bts) */
+ if (bts->osmux.fd.fd != -1) {
+ close(bts->osmux.fd.fd);
+ bts->osmux.fd.fd = -1;
+ }
}

/* Called after config file read, start services */

To view, visit change 29576. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ibd3faa33b28d45048c340b177f13d5685f41a784
Gerrit-Change-Number: 29576
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-MessageType: newchange