[Pkg-voip-commits] r9452 - in /kamailio/trunk/debian: ./ patches/

maniac-guest at alioth.debian.org maniac-guest at alioth.debian.org
Thu Jan 26 22:39:36 UTC 2012


Author: maniac-guest
Date: Thu Jan 26 22:39:35 2012
New Revision: 9452

URL: http://svn.debian.org/wsvn/pkg-voip/?sc=1&rev=9452
Log:
Add patches from upstream fixing memory leaks

Added:
    kamailio/trunk/debian/patches/
    kamailio/trunk/debian/patches/0001-modules_k-presence_xml-Fixed-memory-leak-in-pres_wat.patch
    kamailio/trunk/debian/patches/0002-modules_k-rls-Fixed-memory-leak-in-process_list_and_.patch
    kamailio/trunk/debian/patches/0003-modules_k-rls-Fixed-memory-leak-in-send_full_notify.patch
    kamailio/trunk/debian/patches/0005-modules_k-rls-Memory-leak-in-parse_subs_state-in-res.patch
    kamailio/trunk/debian/patches/series
Modified:
    kamailio/trunk/debian/changelog

Modified: kamailio/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-voip/kamailio/trunk/debian/changelog?rev=9452&op=diff
==============================================================================
--- kamailio/trunk/debian/changelog (original)
+++ kamailio/trunk/debian/changelog Thu Jan 26 22:39:35 2012
@@ -10,9 +10,10 @@
     + add myself as Uploader
   * debian/patches:
     + remove all patches.
+    + add patches for upstream fixing memory leaks.
   * debian/watch updated.
 
- -- Victor Seva <linuxmaniac at torreviejawireless.org>  Tue, 24 Jan 2012 19:21:42 +0100
+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Thu, 26 Jan 2012 23:36:55 +0100
 
 kamailio (1.5.1-2) unstable; urgency=low
 

Added: kamailio/trunk/debian/patches/0001-modules_k-presence_xml-Fixed-memory-leak-in-pres_wat.patch
URL: http://svn.debian.org/wsvn/pkg-voip/kamailio/trunk/debian/patches/0001-modules_k-presence_xml-Fixed-memory-leak-in-pres_wat.patch?rev=9452&op=file
==============================================================================
--- kamailio/trunk/debian/patches/0001-modules_k-presence_xml-Fixed-memory-leak-in-pres_wat.patch (added)
+++ kamailio/trunk/debian/patches/0001-modules_k-presence_xml-Fixed-memory-leak-in-pres_wat.patch Thu Jan 26 22:39:35 2012
@@ -1,0 +1,67 @@
+From 44eed062fa8d82ff0975b7d02e2360abd4e85364 Mon Sep 17 00:00:00 2001
+From: pd <peter.dunkley at crocodile-rcs.com>
+Date: Tue, 24 Jan 2012 17:18:34 +0000
+Subject: [PATCH] modules_k/presence_xml: Fixed memory leak in pres_watcher_allowed()
+
+- xmlFreeDoc() never called for xcap_tree
+- Found and fixed by Paul Pankhurst @ Crocodile RCS
+(cherry picked from commit fcd33bdfa3e5a08f22f4c77fbbf1db53d0afb4bd)
+---
+ modules_k/presence_xml/xcap_auth.c |    9 ++++++++-
+ 1 files changed, 8 insertions(+), 1 deletions(-)
+
+diff --git a/modules_k/presence_xml/xcap_auth.c b/modules_k/presence_xml/xcap_auth.c
+index e9f2ad8..9838a06 100644
+--- a/modules_k/presence_xml/xcap_auth.c
++++ b/modules_k/presence_xml/xcap_auth.c
+@@ -83,13 +83,17 @@ int pres_watcher_allowed(subs_t* subs)
+ 
+ 	node= get_rule_node(subs, xcap_tree);
+ 	if(node== NULL)
++	{
++		xmlFreeDoc(xcap_tree);
+ 		return 0;
++	}
+ 
+ 	/* process actions */	
+ 	actions_node = xmlNodeGetChildByName(node, "actions");
+ 	if(actions_node == NULL)
+ 	{	
+ 		LM_DBG("actions_node NULL\n");
++		xmlFreeDoc(xcap_tree);
+ 		return 0;
+ 	}
+ 	LM_DBG("actions_node->name= %s\n",
+@@ -99,6 +103,7 @@ int pres_watcher_allowed(subs_t* subs)
+ 	if(sub_handling_node== NULL)
+ 	{	
+ 		LM_DBG("sub_handling_node NULL\n");
++		xmlFreeDoc(xcap_tree);
+ 		return 0;
+ 	}
+ 	sub_handling = (char*)xmlNodeGetContent(sub_handling_node);
+@@ -110,6 +115,7 @@ int pres_watcher_allowed(subs_t* subs)
+ 	if(sub_handling== NULL)
+ 	{
+ 		LM_ERR("Couldn't get sub-handling content\n");
++		xmlFreeDoc(xcap_tree);
+ 		return -1;
+ 	}
+ 	if( strncmp((char*)sub_handling, "block",5 )==0)
+@@ -140,11 +146,12 @@ int pres_watcher_allowed(subs_t* subs)
+ 	{
+ 		LM_ERR("unknown subscription handling action\n");
+ 		xmlFree(sub_handling);
++		xmlFreeDoc(xcap_tree);
+ 		return -1;
+ 	}
+ 
+ 	xmlFree(sub_handling);
+-
++	xmlFreeDoc(xcap_tree);
+ 	return 0;
+ 
+ }	
+-- 
+1.7.4.1
+

Added: kamailio/trunk/debian/patches/0002-modules_k-rls-Fixed-memory-leak-in-process_list_and_.patch
URL: http://svn.debian.org/wsvn/pkg-voip/kamailio/trunk/debian/patches/0002-modules_k-rls-Fixed-memory-leak-in-process_list_and_.patch?rev=9452&op=file
==============================================================================
--- kamailio/trunk/debian/patches/0002-modules_k-rls-Fixed-memory-leak-in-process_list_and_.patch (added)
+++ kamailio/trunk/debian/patches/0002-modules_k-rls-Fixed-memory-leak-in-process_list_and_.patch Thu Jan 26 22:39:35 2012
@@ -1,0 +1,28 @@
+From 6acddd35953c7a75d04d03f7a8c177beb08c2a57 Mon Sep 17 00:00:00 2001
+From: pd <peter.dunkley at crocodile-rcs.com>
+Date: Tue, 24 Jan 2012 17:34:52 +0000
+Subject: [PATCH] modules_k/rls: Fixed memory leak in process_list_and_exec()
+
+- xmlFree was called on rl_doc, but xmlFreeDoc should have been called
+- Found and fixed by Paul Pankhurst @ Crocodile RCS
+(cherry picked from commit ca938a37c87782c709b441c682f723d07b05c64c)
+---
+ modules_k/rls/notify.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/modules_k/rls/notify.c b/modules_k/rls/notify.c
+index b9bad7f..d9a1397 100644
+--- a/modules_k/rls/notify.c
++++ b/modules_k/rls/notify.c
+@@ -979,7 +979,7 @@ int process_list_and_exec(xmlNodePtr list_node, str username, str domain,
+ 						LM_DBG("calling myself for rl_node\n");
+ 						res = process_list_and_exec(rl_node, username, domain, function, param);
+ 						xmlFree(uri);
+-						xmlFree(rl_doc);
++						xmlFreeDoc(rl_doc);
+ 					}
+ 					else
+ 					{
+-- 
+1.7.4.1
+

Added: kamailio/trunk/debian/patches/0003-modules_k-rls-Fixed-memory-leak-in-send_full_notify.patch
URL: http://svn.debian.org/wsvn/pkg-voip/kamailio/trunk/debian/patches/0003-modules_k-rls-Fixed-memory-leak-in-send_full_notify.patch?rev=9452&op=file
==============================================================================
--- kamailio/trunk/debian/patches/0003-modules_k-rls-Fixed-memory-leak-in-send_full_notify.patch (added)
+++ kamailio/trunk/debian/patches/0003-modules_k-rls-Fixed-memory-leak-in-send_full_notify.patch Thu Jan 26 22:39:35 2012
@@ -1,0 +1,37 @@
+From a9553f0e0f8c0fac159bc1c4da77501132ebac82 Mon Sep 17 00:00:00 2001
+From: pd <peter.dunkley at crocodile-rcs.com>
+Date: Tue, 24 Jan 2012 17:31:27 +0000
+Subject: [PATCH] modules_k/rls: Fixed memory leak in send_full_notify()
+
+- Package memory is allocated for URIs in add_resource_to_list() but never freed.
+- It should be freed in send_full_notify() at the same time as the memory allocated
+  for the list itself is freed.
+- Found and fixed by Paul Pankhurst @ Crocodile RCS
+(cherry picked from commit 19abd6497cc1431d97383eeea76c34c4a1c5a9da)
+---
+ modules_k/rls/notify.c |    2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+diff --git a/modules_k/rls/notify.c b/modules_k/rls/notify.c
+index d9a1397..6cc3226 100644
+--- a/modules_k/rls/notify.c
++++ b/modules_k/rls/notify.c
+@@ -178,6 +178,7 @@ int send_full_notify(subs_t* subs, xmlNodePtr rl_node, str* rl_uri,
+                    We cannot send this resource, move on. */
+                 LM_ERR("Failed to add a single resource %d vs %d\n", len_est, rls_max_notify_body_len);
+                 uri_list_head = uri_list_head->next;
++				if (last->uri) pkg_free(last->uri);
+                 pkg_free(last);
+             }
+             else
+@@ -212,6 +213,7 @@ int send_full_notify(subs_t* subs, xmlNodePtr rl_node, str* rl_uri,
+ 		{
+             resource_added = 1;
+             uri_list_head = uri_list_head->next;
++			if (last->uri) pkg_free(last->uri);
+             pkg_free(last);
+ 		}
+ 	}
+-- 
+1.7.4.1
+

Added: kamailio/trunk/debian/patches/0005-modules_k-rls-Memory-leak-in-parse_subs_state-in-res.patch
URL: http://svn.debian.org/wsvn/pkg-voip/kamailio/trunk/debian/patches/0005-modules_k-rls-Memory-leak-in-parse_subs_state-in-res.patch?rev=9452&op=file
==============================================================================
--- kamailio/trunk/debian/patches/0005-modules_k-rls-Memory-leak-in-parse_subs_state-in-res.patch (added)
+++ kamailio/trunk/debian/patches/0005-modules_k-rls-Memory-leak-in-parse_subs_state-in-res.patch Thu Jan 26 22:39:35 2012
@@ -1,0 +1,126 @@
+From 14520f905e4354cc4b159745142fedb25b062ec5 Mon Sep 17 00:00:00 2001
+From: pd <peter.dunkley at crocodile-rcs.com>
+Date: Thu, 26 Jan 2012 13:59:06 +0000
+Subject: [PATCH] modules_k/rls: Memory leak in parse_subs_state() in resource_notify.c
+
+- Also the function didn't appear to be doing quite the right thing.
+- Found by Paul Pankhurst @ Crocodile RCS and fixed by Peter Dunkley @ Crocodile RCS
+---
+ modules_k/rls/resource_notify.c |   45 +++++++++++++++++++--------------------
+ 1 files changed, 22 insertions(+), 23 deletions(-)
+
+diff --git a/modules_k/rls/resource_notify.c b/modules_k/rls/resource_notify.c
+index f0b7ea1..762be0c 100644
+--- a/modules_k/rls/resource_notify.c
++++ b/modules_k/rls/resource_notify.c
+@@ -401,14 +401,12 @@ done:
+ }
+ 
+ 
+-int parse_subs_state(str auth_state, str** reason, int* expires)
++int parse_subs_state(str auth_state, str *reason, int *expires)
+ {
+ 	str str_exp;
+-	str* res= NULL;
+ 	char* smc= NULL;
+ 	int len, flag= -1;
+ 
+-
+ 	if( strncmp(auth_state.s, "active", 6)== 0)
+ 		flag= ACTIVE_STATE;
+ 
+@@ -428,19 +426,14 @@ int parse_subs_state(str auth_state, str** reason, int* expires)
+ 			LM_ERR("terminated state and no reason found");
+ 			return -1;
+         }
+-		res= (str*)pkg_malloc(sizeof(str));
+-		if(res== NULL)
+-        {
+-			ERR_MEM(PKG_MEM_STR);
+-		}
+ 		len=  auth_state.len- 10- 1- 7;
+-		res->s= (char*)pkg_malloc(len* sizeof(char));
+-		if(res->s== NULL)
++		reason->s = (char*) pkg_malloc(len* sizeof(char));
++		if (reason->s== NULL)
+ 		{
+ 			ERR_MEM(PKG_MEM_STR);
+ 		}
+-		memcpy(res->s, smc+ 8, len);
+-		res->len= len;
++		memcpy(reason->s, smc+ 8, len);
++		reason->len= len;
+ 		return TERMINATED_STATE;
+ 	}
+ 	
+@@ -468,15 +461,9 @@ int parse_subs_state(str auth_state, str** reason, int* expires)
+ 		return flag;
+ 	
+ 	}
+-	return -1;
+ 
+ error:
+-	if(res)
+-	{
+-		if(res->s)
+-			pkg_free(res->s);
+-		pkg_free(res);
+-	}
++	if (reason->s) pkg_free(reason->s);
+ 	return -1;
+ }
+ 
+@@ -492,7 +479,7 @@ int rls_handle_notify(struct sip_msg* msg, char* c1, char* c2)
+ 	int n_query_cols= 0;
+ 	str auth_state= {0, 0};
+ 	int found= 0;
+-	str* reason= NULL;
++	str reason = {0, 0};
+ 	int auth_flag;
+ 	struct hdr_field* hdr= NULL;
+ 	int n, expires= -1;
+@@ -680,12 +667,18 @@ int rls_handle_notify(struct sip_msg* msg, char* c1, char* c2)
+ 	query_vals[n_query_cols].val.int_val= auth_flag; 
+ 	n_query_cols++;
+ 
+-	if(reason)
+-	{
+ 		query_cols[n_query_cols]= &str_reason_col;
+ 		query_vals[n_query_cols].type = DB1_STR;
+ 		query_vals[n_query_cols].nul = 0;
+-		query_vals[n_query_cols].val.str_val= *reason;
++	if(reason.len > 0)
++	{
++		query_vals[n_query_cols].val.str_val.s= reason.s;
++		query_vals[n_query_cols].val.str_val.len= reason.len;
++	}	
++	else
++	{
++		query_vals[n_query_cols].val.str_val.s = "";
++		query_vals[n_query_cols].val.str_val.len = 0;
+ 		n_query_cols++;
+ 	}
+ 	query_cols[n_query_cols]= &str_content_type_col;
+@@ -761,6 +754,9 @@ done:
+ 		pkg_free(res_id->s);
+ 		pkg_free(res_id);
+ 	}
++
++	if (reason.s) pkg_free(reason.s);
++
+ 	free_to_params(&TO);
+ 	return 1;
+ 
+@@ -770,6 +766,9 @@ error:
+ 		pkg_free(res_id->s);
+ 		pkg_free(res_id);
+ 	}
++
++	if (reason.s) pkg_free(reason.s);
++
+ 	free_to_params(&TO);
+ 	return -1;
+ }
+-- 
+1.7.4.1
+

Added: kamailio/trunk/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-voip/kamailio/trunk/debian/patches/series?rev=9452&op=file
==============================================================================
--- kamailio/trunk/debian/patches/series (added)
+++ kamailio/trunk/debian/patches/series Thu Jan 26 22:39:35 2012
@@ -1,0 +1,4 @@
+0001-modules_k-presence_xml-Fixed-memory-leak-in-pres_wat.patch
+0002-modules_k-rls-Fixed-memory-leak-in-process_list_and_.patch
+0003-modules_k-rls-Fixed-memory-leak-in-send_full_notify.patch
+0005-modules_k-rls-Memory-leak-in-parse_subs_state-in-res.patch




More information about the Pkg-voip-commits mailing list