[PATCH] memleak in smsbox

Rafael <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hi,

I traced a memory leak on the current CVS to smsbox_req_handle in 
smsbox.c  (thx to --with-malloc=check and SIGQUIT :)  I don't see the 
stored_uuid octstr destroyed on the normal exit path (when no errors 
occurs.)  The following patch fixes the leak for me.  The same two lines 
are later repeated on the error path, perhaps the gotos can be reworked 
somehow to avoid this...

Cheers,

-Rafael
---
Rafael R. Reilova
ATG, Puerto Rico

--- gateway.orig/gw/smsbox.c    2006-04-18 11:15:40.000000000 -0400
+++ gateway/gw/smsbox.c 2006-04-26 16:44:47.000000000 -0400
@@ -2342,6 +2342,8 @@
     octstr_destroy(newfrom);
     *status = HTTP_ACCEPTED;
     returnerror = octstr_create("Sent.");
+    if (stored_uuid)
+        octstr_destroy(stored_uuid);

     /*
      * Append all denied receivers to the returned body in case this is
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.