[PATCH] Memory leak in wap-appl.c

Vjacheslav Chekushin <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization LMT
Message-ID <[email protected]>
Hi, list.

There is obvious memory leak in wap-appl.c

     ret = wml_compile(content->body, content->charset, &wmlc,
                       content->version);

If you will check wml_compile function from wml_compiler.c, than you'll see that
it allocates "wmlc" at the start and doesn't deallocate it even if
we have compilation error.
So in case of compilation error we must free it in wap-appl.c

Provided patch fixes this problem.


-- 
Vjacheslav Chekushin                                mailto:[email protected]
Latvian Mobile Phone Company                        http://www.lmt.lv
memory_leaks.patch (text/plain, 264 B)
--- ../gateway_base/gw/wap-appl.c	Thu Oct  9 15:04:18 2003
+++ gw/wap-appl.c	Thu Oct 23 16:58:37 2003
@@ -1230,6 +1230,7 @@
     if (ret == 0)
         return wmlc;
 
+    octstr_destroy(wmlc);
     warning(0, "WSP: WML compilation failed.");
     return NULL;
 }
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.