[PATCH][RESEND][ANNOYANCE] Fix empty device_headers and small memory leak with connection-oriented wap

Paul P Komkoff Jr <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization Department of Fish & Wildlife
Message-ID <[email protected]>
When I'll get tired of this ...
-- 
Paul P 'Stingray' Komkoff Jr // http://stingr.net/key <- my pgp key
 This message represents the official view of the voices in my head
fixheaders (text/plain, 1.6 KB)
Index: gateway.C5/gw/wap-appl.c
===================================================================
--- gateway.C5.orig/gw/wap-appl.c	2005-02-28 13:36:24.222086760 +0300
+++ gateway.C5/gw/wap-appl.c	2005-02-28 14:21:33.017287296 +0300
@@ -731,7 +731,7 @@
     struct content content;
     int converted;
     WSPMachine *sm;
-    List *device_headers;
+    List *device_headers, *t_headers;
     WAPAddrTuple *addr_tuple;
     Octstr *ua, *server;
 
@@ -744,12 +744,17 @@
      * request be obviously will not find any session machine entry. */
     sm = find_session_machine_by_id(session_id);
 
+    device_headers = gwlist_create();
+
     /* ensure we pass only the original headers to the convertion routine */
-    device_headers = (orig_event->type == S_MethodInvoke_Ind) ?
+    t_headers = (orig_event->type == S_MethodInvoke_Ind) ?
+        orig_event->u.S_MethodInvoke_Ind.session_headers :
+        NULL;
+    if (t_headers != NULL) http_header_combine(device_headers, t_headers);
+    t_headers = (orig_event->type == S_MethodInvoke_Ind) ?
         orig_event->u.S_MethodInvoke_Ind.request_headers :
         orig_event->u.S_Unit_MethodInvoke_Ind.request_headers;
-    if (device_headers == NULL)
-        device_headers = gwlist_create();
+    if (t_headers != NULL) http_header_combine(device_headers, t_headers);
 
     /* 
      * We are acting as a proxy. Hence ensure we log a correct HTTP response
@@ -1056,6 +1061,7 @@
     octstr_destroy(content.type); /* body was re-used above */
     octstr_destroy(content.charset);
     octstr_destroy(url);          /* same as content.url */
+    http_destroy_headers(device_headers);
 
     counter_decrease(fetches);
 }
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.