A new try :(

Attachment: cvs.diff
Description: Binary data



Aarno

On 26.11.2003, at 12:32, Alexander Malysh wrote:

Hi Aarno,

would you please explain???

RCS file: /home/cvs/gateway/gw/dlr.c,v
retrieving revision 1.43
diff -u -B -b -r1.43 dlr.c
--- gw/dlr.c 15 Nov 2003 13:14:23 -0000 1.43
+++ gw/dlr.c 26 Nov 2003 10:15:54 -0000
@@ -362,10 +362,11 @@
* NOTE: If typ is end status (e.g. DELIVERED) then dlr entry
* will be removed from DB.
*/
-Msg *dlr_find(const Octstr *smsc, const Octstr *ts, const Octstr *dst, int
typ)
+Msg *dlr_find(Octstr *smsc, const Octstr *ts, const Octstr *dst, int typ)

why not const here? With const we just tell the caller: "we do not modify your
arg."

 {
     Msg        *msg = NULL;
     struct dlr_entry *dlr = NULL;
+    Octstr *namos;

     if(octstr_len(smsc) == 0) {
        warning(0, "DLR[%s]: Can't find a dlr without smsc-id", dlr_type());
@@ -373,16 +374,19 @@
     }

     /* check if we have handler registered */
-    if (handles == NULL || handles->dlr_get == NULL)
+    if (handles == NULL || handles->dlr_get == NULL) {
         return NULL;
+    }

+ namos = octstr_duplicate(smsc);

why duplicate smsc Octstr here and then free it ??
if dlr entry is not found we just avoid memory allocation...

debug("dlr.dlr", 0, "DLR[%s]: Looking for DLR smsc=%s, ts=%s, dst=%s,
type=%d",
- dlr_type(), octstr_get_cstr(smsc),
octstr_get_cstr(ts), octstr_get_cstr(dst), typ);
+ dlr_type(), octstr_get_cstr(namos),
octstr_get_cstr(ts), octstr_get_cstr(dst), typ);

     dlr = handles->dlr_get(smsc, ts, dst);
     if (dlr == NULL)  {
         warning(0, "DLR[%s]: DLR for DST<%s> not found.",
                       dlr_type(), octstr_get_cstr(dst));
+        octstr_destroy(namos);
         return NULL;
     }

@@ -392,7 +396,7 @@
msg->sms.sms_type = report;
msg->sms.service = octstr_duplicate(dlr->service);
msg->sms.dlr_mask = typ;
- msg->sms.smsc_id = octstr_duplicate(dlr->smsc);
+ msg->sms.smsc_id = dlr->smsc;
msg->sms.receiver = octstr_duplicate(dlr->destination);
msg->sms.sender = octstr_duplicate(dlr->source);
/* if dlr_url was present, recode it here again */
@@ -414,6 +418,7 @@
} else {
debug("dlr.dlr", 0, "DLR[%s]: Ignoring DLR message because of mask
type=%d dlr->mask=%d", dlr_type(), typ, dlr->mask);
/* ok that was a status report but we where not interested in having
it */
+ dlr_entry_destroy(dlr);

why dlr_entry_destroy must be called here ???
see bellow... there we free that struct.

         msg = NULL;
     }

@@ -432,6 +437,7 @@
         }
     }

+    octstr_destroy(namos);
     /* destroy struct dlr_entry */
     dlr_entry_destroy(dlr);

The same agrs for dlr_mysq.c ...


On Wednesday 26 November 2003 11:53, Aarno Syv�nen wrote:
Hi List,

I attach cvs diff for fixing kannel leaks (as tested with our mmsc).
There are new wrappers I used to find these leaks., too. And
there was one unhandled NULL pointer.

Perhaps you check & test these

-- Best regards / Mit besten Gr��en aus D�sseldorf

Dipl.-Ing.
Alexander Malysh
___________________________________________

Centrium GmbH
Vogelsanger Weg 80
40470 D�sseldorf

Fon: +49 (0211) 74 84 51 80
Fax: +49 (0211) 277 49 109

email: [EMAIL PROTECTED]
web: www.centrium.de
msn: [EMAIL PROTECTED]
icq: 98063111
___________________________________________

Please avoid sending me Word, Excel or PowerPoint attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html


Reply via email to