diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-06-09 14:44:47 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-07-19 19:54:33 +0200 |
commit | 9b9a171da992a0fd38ded47e3de25b860ac22f15 (patch) | |
tree | 2b8a56afbe3dcca7eaf67ef21a6dce35331740a9 | |
parent | 5e3bbba96286f672b56568ee58785621054b72e5 (diff) |
bsc: Fix a memory leak when the BSC is not allowed to open a connection
When the BSC is refusing to open an outgoing connection the SCCP
connection was leaked. Use the normal free as the socket should
be either closed or disconnected.
-rw-r--r-- | openbsc/src/osmo-bsc/osmo_bsc_api.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_api.c b/openbsc/src/osmo-bsc/osmo_bsc_api.c index 1a6d806a2..d02b0b5e4 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_api.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_api.c @@ -24,6 +24,8 @@ #include <osmocom/gsm/protocol/gsm_08_08.h> #include <osmocom/gsm/gsm0808.h> +#include <osmocom/sccp/sccp.h> + #define return_when_not_connected(conn) \ if (!conn->sccp_con) {\ LOGP(DMSC, LOGL_ERROR, "MSC Connection not present.\n"); \ @@ -102,11 +104,13 @@ static int bsc_compl_l3(struct gsm_subscriber_connection *conn, struct msgb *msg conn->bts->cell_identity); if (!resp) { LOGP(DMSC, LOGL_DEBUG, "Failed to create layer3 message.\n"); + sccp_connection_free(conn->sccp_con->sccp); bsc_delete_connection(conn->sccp_con); return BSC_API_CONN_POL_REJECT; } if (bsc_open_connection(conn->sccp_con, resp) != 0) { + sccp_connection_free(conn->sccp_con->sccp); bsc_delete_connection(conn->sccp_con); msgb_free(resp); return BSC_API_CONN_POL_REJECT; |