diff options
Diffstat (limited to 'openbsc/src/gsm_04_11.c')
-rw-r--r-- | openbsc/src/gsm_04_11.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/openbsc/src/gsm_04_11.c b/openbsc/src/gsm_04_11.c index 8db402b33..9218783ff 100644 --- a/openbsc/src/gsm_04_11.c +++ b/openbsc/src/gsm_04_11.c @@ -162,19 +162,11 @@ static int gsm340_rx_tpdu(struct msgb *msg) u_int8_t address_lv[12]; /* according to 03.40 / 9.1.2.5 */ int rc = 0; - if (!tall_sms_ctx) - tall_sms_ctx = talloc_named_const(tall_bsc_ctx, 1, - "sms_submit"); - sms = talloc(tall_sms_ctx, struct sms_submit); if (!sms) return -ENOMEM; memset(sms, 0, sizeof(*sms)); - if (!tall_gsms_ctx) - tall_gsms_ctx = talloc_named_const(tall_bsc_ctx, 1, - "sms"); - gsms = talloc(tall_gsms_ctx, struct gsm_sms); if (!gsms) { talloc_free(sms); @@ -513,3 +505,9 @@ int gsm0411_send_sms(struct gsm_lchan *lchan, struct sms_deliver *sms) return gsm0411_sendmsg(msg); } + +static __attribute__((constructor)) void on_dso_load_sms(void) +{ + tall_sms_ctx = talloc_named_const(tall_bsc_ctx, 1, "sms_submit"); + tall_gsms_ctx = talloc_named_const(tall_bsc_ctx, 1, "sms"); +} |