Author: sayer
Date: 2009-10-13 22:37:49 +0200 (Tue, 13 Oct 2009)
New Revision: 1540

Modified:
   trunk/core/plug-in/sipctrl/trans_layer.cpp
Log:
only allocate/memcpy to-tag if len>0

Modified: trunk/core/plug-in/sipctrl/trans_layer.cpp
===================================================================
--- trunk/core/plug-in/sipctrl/trans_layer.cpp  2009-10-13 20:07:07 UTC (rev 
1539)
+++ trunk/core/plug-in/sipctrl/trans_layer.cpp  2009-10-13 20:37:49 UTC (rev 
1540)
@@ -1074,9 +1074,14 @@
 
                t->reset_timer(STIMER_L, L_TIMER, bucket->get_id());
 
-               t->to_tag.s = new char[to_tag.len];
-               t->to_tag.len = to_tag.len;
-               memcpy((void*)t->to_tag.s,to_tag.s,to_tag.len);
+               if (t->to_tag.len>0) {
+                       t->to_tag.s = new char[to_tag.len];
+                       t->to_tag.len = to_tag.len;
+                       memcpy((void*)t->to_tag.s,to_tag.s,to_tag.len);
+               } else {
+                       t->to_tag.s = NULL;
+                       t->to_tag.len = 0;
+               }
                
                goto pass_reply;
                

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to