aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-01-16 18:15:26 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-01-16 20:31:59 +0100
commit05bbec722769c4558daf9211f0734c81ddb056ac (patch)
tree2111c2e9a284764f8bfbc19ff5aaadc05625e19c /openbsc
parent91f587ed98e40bd138049102d78181aaa97f4ebd (diff)
bsc: Fix possible crash when the lchan->conn alloc failed
Another null pointer dereference found by clang.
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/bsc_api.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/openbsc/src/bsc_api.c b/openbsc/src/bsc_api.c
index a9e5f71ed..87ab9814f 100644
--- a/openbsc/src/bsc_api.c
+++ b/openbsc/src/bsc_api.c
@@ -478,9 +478,12 @@ int gsm0408_rcvmsg(struct msgb *msg, uint8_t link_id)
} else {
rc = BSC_API_CONN_POL_REJECT;
lchan->conn = subscr_con_allocate(msg->lchan);
+ if (!lchan->conn) {
+ lchan_release(lchan, 0, 0);
+ return -1;
+ }
- if (lchan->conn)
- rc = api->compl_l3(lchan->conn, msg, 0);
+ rc = api->compl_l3(lchan->conn, msg, 0);
if (rc != BSC_API_CONN_POL_ACCEPT) {
lchan->conn->lchan = NULL;