RE: This patch fixes...
"Rene Kluwen" <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Attached, the simplified version with the modification you mentioned. From: Alexander Malysh [mailto:[email protected]] On Behalf Of Alexander Malysh Sent: Thursday, 03 November, 2011 10:05 To: Rene Kluwen Cc: [email protected]; [email protected] Subject: Re: This patch fixes... Hi Rene, SMPP rely on the fact that tlv dict exist and I find it should be here. You can simplify your code because dict_destroy already checks for Dict to be NULL and tlv dict is always initialized. Alex Am 02.11.2011 um 19:47 schrieb Rene Kluwen: .a memory leak in opensmppbox whilst using v3.4 tlv values in incoming messages. Rather than using this patch, I don't want to allocate a dict in smpp_pdu_create at all. But I am not sure about how it will affect the rest of the smpp code. == Rene <tlv_memory_leak.diff>
tlv_memory_leak.diff
(application/octet-stream, 1.6 KB)
Index: gw/opensmppbox.c
===================================================================
--- gw/opensmppbox.c (revision 62)
+++ gw/opensmppbox.c (working copy)
@@ -901,6 +901,7 @@
if (box->version > 0x33) {
pdu2->u.deliver_sm.receipted_message_id = octstr_duplicate(msgid2);
pdu2->u.deliver_sm.message_state = dlr_state;
+ dict_destroy(pdu2->u.deliver_sm.tlv);
pdu2->u.deliver_sm.tlv = meta_data_get_values(msg->sms.meta_data, "smpp");
}
pdu2->u.deliver_sm.short_message = octstr_format("id:%S sub:001 dlvrd:%S submit date:%s done date:%s stat:%S err:%s text:%12s", msgid2, dlvrd, submit_date_c_str, done_date_c_str, dlr_status, err, text);
@@ -913,6 +914,7 @@
if (box->version > 0x33) {
pdu->u.deliver_sm.receipted_message_id = octstr_duplicate(msgid);
pdu->u.deliver_sm.message_state = dlr_state;
+ dict_destroy(pdu->u.deliver_sm.tlv);
pdu->u.deliver_sm.tlv = meta_data_get_values(msg->sms.meta_data, "smpp");
}
pdu->u.deliver_sm.short_message = octstr_format("id:%S sub:001 dlvrd:%S submit date:%s done date:%s stat:%S err:%s text:%12s", msgid, dlvrd, submit_date_c_str, done_date_c_str, dlr_status, err, text);
@@ -1053,6 +1055,7 @@
}
if (box->version > 0x33) {
+ dict_destroy(pdu2->u.deliver_sm.tlv);
pdu2->u.deliver_sm.tlv = meta_data_get_values(msg->sms.meta_data, "smpp");
}
@@ -1064,6 +1067,7 @@
}
else {
if (box->version > 0x33) {
+ dict_destroy(pdu->u.deliver_sm.tlv);
pdu->u.deliver_sm.tlv = meta_data_get_values(msg->sms.meta_data, "smpp");
}