RE: kannel 1.2.1 crashes then dlr in use

"Oded Arbel" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]]

> Today i set up some check code into smsc_emi2.c:
> 
> --- smsc_emi2.orig      Wed Sep  4 21:08:52 2002
> +++ smsc_emi2.c Sun Nov 10 10:00:12 2002
> @@ -976,7 +976,11 @@ static int emi2_handle_smscreq (SMSCConn
>                   * Recode the msg structure with the given msgdata.
>                   * Note: the DLR URL is delivered in msg->sms.dlr_url
> already.
>                   */
> -                dlrmsg->sms.msgdata =
> octstr_duplicate(emimsg->fields[E50_AMSG]);
> +                               dlrmsg->sms.msgdata =
> octstr_duplicate(emimsg->fields[E50_AMSG]);
> +                if (dlrmsg->sms.msgdata == NULL) {
> +                                 dlrmsg->sms.msgdata = 
> octstr_create("");
> +                                 info(0, "EMI2[%s]: msgdata is NULL",
> octstr_get_cstr(privdata->name));
> +                }
>                  octstr_hex_to_binary(dlrmsg->sms.msgdata);

You can do it far easier with

dlrmsg->sms.msgdata = emimsg->fields[E50_AMSG] != NULL ? octstr_duplicate(emimsg->fields[E50_AMSG]) : octstr_create("");

and allow the compile to do some more optimizations if it likes to. you don't really need to log the fact that the message is empty : it gets sufficiently logged at other places.

--
Oded Arbel
m-Wise mobile solutions
[email protected]

+972-9-9581711 (116)
+972-67-340014

::..
If you sell diamonds, you cannot expect to have many customers.
But a diamond is a diamond even if there are no customers.
                -- Swami Prabhupada
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.