diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2019-04-15 13:46:44 +0200 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2019-04-15 13:46:47 +0200 |
commit | 0714002e28366a063d3e484212f8614a3d3922f2 (patch) | |
tree | 7c3cf843c9f6b9abd9379c43b426dcbb57b92c14 | |
parent | e2bd9eb37d8160b436a5a1bffc14690321f40ae6 (diff) |
smpp: fix vlr_subscr use count bugs
In smpp_openbsc.c submit_to_sms(), "get" the appropriate use count upon
assigning sms->receiver, fixing a -1 use count upon sms_free().
Also, avoid a "put" of a NULL subscriber in the same function.
Related: OS#3930
Change-Id: Idaf01cd3cfa08088ce0d543d0576db957dc94262
-rw-r--r-- | src/libmsc/smpp_openbsc.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libmsc/smpp_openbsc.c b/src/libmsc/smpp_openbsc.c index 01c39f906..151c788b2 100644 --- a/src/libmsc/smpp_openbsc.c +++ b/src/libmsc/smpp_openbsc.c @@ -139,7 +139,8 @@ static int submit_to_sms(struct gsm_sms **psms, struct gsm_network *net, } else { LOGP(DLSMS, LOGL_ERROR, "SMPP neither message payload nor valid sm_length.\n"); - vlr_subscr_put(dest, VSUB_USE_SMPP); + if (dest) + vlr_subscr_put(dest, VSUB_USE_SMPP); return ESME_RINVPARLEN; } } @@ -152,6 +153,12 @@ static int submit_to_sms(struct gsm_sms **psms, struct gsm_network *net, /* fill in the destination address */ sms->receiver = dest; + if (dest) { + /* Replace use count from above subscr_by_dst (VSUB_USE_SMPP) by the sms->receiver use count + * (VSUB_USE_SMS_RECEIVER) */ + vlr_subscr_get(sms->receiver, VSUB_USE_SMS_RECEIVER); + vlr_subscr_put(dest, VSUB_USE_SMPP); + } sms->dst.ton = submit->dest_addr_ton; sms->dst.npi = submit->dest_addr_npi; if (dest) |