aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-12-25 15:57:34 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-12-26 09:40:48 +0100
commit445e615d03fd18f05401d094177f527af4a3c2cf (patch)
tree3c301917ed460356776149ae6f479c8252dc0d3c /openbsc
parent994dcbb2017c91b4e8b3a48a93ced215a7d63159 (diff)
sms: Always go through the database and the smsqueue to send messages
This is also fixing a memory and subscriber leak. Make sure to always release the gsm_sms structure.
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/vty_interface_layer3.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/openbsc/src/vty_interface_layer3.c b/openbsc/src/vty_interface_layer3.c
index 7df0d7b2c..c01d9c6eb 100644
--- a/openbsc/src/vty_interface_layer3.c
+++ b/openbsc/src/vty_interface_layer3.c
@@ -171,16 +171,15 @@ static int _send_sms_str(struct gsm_subscriber *receiver, char *str,
sms = sms_from_text(receiver, str);
sms->protocol_id = tp_pid;
- if(!receiver->lac){
- /* subscriber currently not attached, store in database */
- if (db_sms_store(sms) != 0) {
- LOGP(DSMS, LOGL_ERROR, "Failed to store SMS in Database\n");
- return CMD_WARNING;
- }
- } else {
- gsm411_send_sms_subscr(receiver, sms);
+ /* store in database for the queue */
+ if (db_sms_store(sms) != 0) {
+ LOGP(DSMS, LOGL_ERROR, "Failed to store SMS in Database\n");
+ sms_free(sms);
+ return CMD_WARNING;
}
+ sms_free(sms);
+ sms_queue_trigger(receiver->net->sms_queue);
return CMD_SUCCESS;
}