[sr-dev] git:master: modules_k/textops: Fixed memcpy problem

Marius Zbihlei marius.zbihlei at 1and1.ro
Tue Jan 18 11:32:46 CET 2011


Module: sip-router
Branch: master
Commit: 958df5cda2af963b893ab7d8af6ce4f4a00cb228
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=958df5cda2af963b893ab7d8af6ce4f4a00cb228

Author: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Committer: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Date:   Tue Jan 18 12:27:08 2011 +0200

modules_k/textops: Fixed memcpy problem

The commit  4b6cfe30 did nothing.

---

 modules_k/textops/textops.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/modules_k/textops/textops.c b/modules_k/textops/textops.c
index f5da969..6b8fa42 100644
--- a/modules_k/textops/textops.c
+++ b/modules_k/textops/textops.c
@@ -1475,12 +1475,13 @@ int add_hf_helper(struct sip_msg* msg, str *str1, str *str2,
 	len=s0.len;
 	if (str2) len+= str2->len + REQ_LINE(msg).uri.len;
 
-	if (likely(len>0)){
-		s = (char*)pkg_malloc(len);
-		if (!s) {
-			LM_ERR("no pkg memory left\n");
-			return -1;
-		}
+	s  = (char*)pkg_malloc(len);
+	if (!s) {
+		LM_ERR("no pkg memory left\n");
+		return -1;
+	}
+
+	if (likely(s0.len>0)){
 		memcpy(s, s0.s, s0.len);
 	}
 




More information about the sr-dev mailing list