[Serusers] tls, xlog and select framework syntax

Michal Matyska michal at iptel.org
Sun Feb 26 17:40:30 CET 2006


Hi,

there was problem when xlog's select was resolving the structure and
tried to free block which was not allocated... the string was inside
bigger block.

Please update select.c from CVS or apply attached patch.

Michal

On Thu, Feb 23, 2006 at 11:58:25AM +0100, Klaus Darilion wrote:
> Hi Michal!
> 
> I've update my CVS copy and now xlog with @tls works. But I've found a 
> new problem:
> 
> This works fine:
> xlog("L_ERR","@tls      = %@tls      (String description of the TLS 
> layer)\n");
> 
> This causes a bug when starting ser:
> xlog("L_ERR","@tls.peer = %@tls.peer (Peer certificate subject common 
> name)\n");
> 
> I've attached the relevant log output when parsing these two xlog 
> statements. I do not know if this is a bug in xlog or tls module.
> 
> regards
> klaus
> 

-------------- next part --------------
Index: select.c
===================================================================
RCS file: /cvsroot/ser/sip_router/select.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- select.c	20 Feb 2006 18:59:34 -0000	1.7
+++ select.c	26 Feb 2006 16:32:34 -0000	1.8
@@ -1,5 +1,5 @@
 /*
- * $Id: select.c,v 1.7 2006/02/20 18:59:34 mma Exp $
+ * $Id: select.c,v 1.8 2006/02/26 16:32:34 mma Exp $
  *
  * Copyright (C) 2005-2006 iptelorg GmbH
  *
@@ -29,6 +29,9 @@
  *  2005-12-19  select framework (mma)
  *  2006-01-19  multiple nested calls, IS_ALIAS -> NESTED flag renamed (mma)
  *              DIVERSION flag checked
+ *  2006-02-26  don't free str when changing type STR -> DIVERSION (mma)
+ *				it can't be freeable sometimes (e.g. xlog's select)
+ *
  */
 
 
@@ -99,7 +102,11 @@
 
 		accepted:
 		if (t->table[table_idx].flags & DIVERSION) {
-			if (s->params[param_idx].type == SEL_PARAM_STR) pkg_free(s->params[param_idx].v.s.s);
+			/* if (s->params[param_idx].type == SEL_PARAM_STR) pkg_free(s->params[param_idx].v.s.s); */
+			/* don't free it (the mem can leak only once at startup)
+			 * the parsed string can live inside larger string block
+			 * e.g. when xlog's select is parsed
+			 */
 			s->params[param_idx].type = SEL_PARAM_DIV;
 			s->params[param_idx].v.i = t->table[table_idx].flags & DIVERSION_MASK;
 			


More information about the sr-users mailing list