summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-03-03 16:12:04 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-03-03 16:12:04 +0100
commit51273157fa18034349d6ac1395c6d43e80cc07c0 (patch)
treef1855398903903d86295fd113e2425786f9a25df
parent6a1d172c952149aa6548f37b1e8fb8d9d931b329 (diff)
channel_test: don't segfault if paging fails
Add due assertions of return value validity, otherwise leading to segfaults.
-rw-r--r--openbsc/tests/channel/channel_test.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/openbsc/tests/channel/channel_test.c b/openbsc/tests/channel/channel_test.c
index cd6a1fd37..567460722 100644
--- a/openbsc/tests/channel/channel_test.c
+++ b/openbsc/tests/channel/channel_test.c
@@ -32,7 +32,7 @@
static int s_end = 0;
static struct gsm_subscriber_connection s_conn;
static void *s_data;
-static gsm_cbfn *s_cbfn;
+static gsm_cbfn *s_cbfn = NULL;
/* our handler */
static int subscr_cb(unsigned int hook, unsigned int event, struct msgb *msg, void *data, void *param)
@@ -83,7 +83,10 @@ int main(int argc, char **argv)
OSMO_ASSERT(subscr->group->net == network);
/* Ask for a channel... */
- subscr_request_channel(subscr, RSL_CHANNEED_TCH_F, subscr_cb, (void*)0x2342L);
+ struct subscr_request *sr;
+ sr = subscr_request_channel(subscr, RSL_CHANNEED_TCH_F, subscr_cb, (void*)0x2342L);
+ OSMO_ASSERT(sr);
+ OSMO_ASSERT(s_cbfn);
s_cbfn(101, 200, (void*)0x1323L, &s_conn, s_data);
OSMO_ASSERT(s_end);