diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-01-16 18:15:26 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-01-16 20:31:59 +0100 |
commit | 05bbec722769c4558daf9211f0734c81ddb056ac (patch) | |
tree | 2111c2e9a284764f8bfbc19ff5aaadc05625e19c | |
parent | 91f587ed98e40bd138049102d78181aaa97f4ebd (diff) |
bsc: Fix possible crash when the lchan->conn alloc failed
Another null pointer dereference found by clang.
-rw-r--r-- | openbsc/src/bsc_api.c | 7 |
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; |