sgsn: Fix access to subscr in sgsn_auth_update (Coverity)
Currently the access to subscr->sgsn_data->error_cause is not
protected against subscr == NULL like it is done in other code paths
of sgsn_auth_update.
This commit adds a conditional to avoid a NULL-dereference.
Fixes: Coverity CID 1264589
Sponsored-by: On-Waves ehf
diff --git a/openbsc/src/gprs/sgsn_auth.c b/openbsc/src/gprs/sgsn_auth.c
index 9f526dc..41f7c41 100644
--- a/openbsc/src/gprs/sgsn_auth.c
+++ b/openbsc/src/gprs/sgsn_auth.c
@@ -257,7 +257,7 @@
gsm0408_gprs_access_granted(mmctx);
break;
case SGSN_AUTH_REJECTED:
- gmm_cause = subscr->sgsn_data->error_cause;
+ gmm_cause = subscr ? subscr->sgsn_data->error_cause : 0;
if (subscr && (subscr->flags & GPRS_SUBSCRIBER_CANCELLED) != 0)
gsm0408_gprs_access_cancelled(mmctx, gmm_cause);