Re: Kannel crashes when dlrmask = 8 requested (EMI2 protocol) patch
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello!
I can't see where is memory leak. :(
if we change octstr_duplicate(emimsg->fields[E50_AMSG]) to octstr_create
("")?
or then we initialize all fields to NULL in get_fields(...), before use,
like
for (fieldno = 0; fieldno < SZ50; fieldno++) {
result->fields[fieldno] = NULL;
}
and change patch to check mimsg->fields[E50_AMSG] with NULL and if NULL
make octstr_create("") .
second help to avoid use variables with unknown content in future.
with best wishes
German Aksenov
phone: (095)258-7258 ext. 7836
Andreas Fink
<[email protected] To: [email protected]
> cc:
Subject: Re: Kannel crashes when dlrmask = 8 requested (EMI2 protocol)
13.11.2002 17:30 patch
On Mittwoch, November 13, 2002, at 03:27 Uhr, [email protected] wrote:
>
> Hello!
>
> In function emi2_handle_smscreq we have dlrmsg->sms.msgdata =
> octstr_duplicate(emimsg->fields[E50_AMSG]); what may be incoreect
> because in OT == 51 reply message dosn't contain E50_AMSG field and
> emimsg
> = get_fields(str, privdata->name); (called before) dosn't initialize
> this
> field to any value.
> This patch helps...
>
> --- smsc_emi2.c.orig Wed Nov 13 15:06:39 2002
> +++ smsc_emi2.c Wed Nov 13 15:08:25 2002
> @@ -976,7 +976,7 @@ 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_create("");
> octstr_hex_to_binary(dlrmsg->sms.msgdata);
> dlrmsg->sms.sms_type = report;
>
>
this creates a memory leak...
no good.
> any comments? May be better to fix get_fields(...) function (in
> emimsg.c)
> to initialize all fields to NULL before use.
>
> with best wishes
> German Aksenov
> phone: (095)258-7258 ext. 7836
>
>
>