[asterisk-dev] [asterisk-commits] dvossel: trunk r201678 - in /trunk: apps/ channels/h323/ channels/misdn/ chan...

Kevin P. Fleming kpfleming at digium.com
Tue Jun 23 12:10:08 CDT 2009


SVN commits to the Asterisk project wrote:
> Author: dvossel
> Date: Thu Jun 18 11:37:42 2009
> New Revision: 201678
> 
> URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=201678
> Log:
> fixes some memory leaks and redundant conditions
> 
> (closes issue #15269)
> Reported by: contactmayankjain
> Patches:
>       patch.txt uploaded by contactmayankjain (license 740)
>       memory_leak_stuff.trunk.diff uploaded by dvossel (license 671)
> Tested by: contactmayankjain, dvossel


> Modified: trunk/main/ast_expr2.c
> URL: http://svn.asterisk.org/svn-view/asterisk/trunk/main/ast_expr2.c?view=diff&rev=201678&r1=201677&r2=201678
> ==============================================================================
> --- trunk/main/ast_expr2.c (original)
> +++ trunk/main/ast_expr2.c Thu Jun 18 11:37:42 2009
> @@ -2415,6 +2415,7 @@
>  free_value (struct val *vp)
>  {	
>  	if (vp==NULL) {
> +		free(vp);
>  		return;
>  	}
>  	if (vp->type == AST_EXPR_string || vp->type == AST_EXPR_numeric_string)

This change looks bogus; there is no point in calling free() if we know
that vp is NULL.

> Modified: trunk/main/ast_expr2f.c
> URL: http://svn.asterisk.org/svn-view/asterisk/trunk/main/ast_expr2f.c?view=diff&rev=201678&r1=201677&r2=201678
> ==============================================================================
> --- trunk/main/ast_expr2f.c (original)
> +++ trunk/main/ast_expr2f.c Thu Jun 18 11:37:42 2009
> @@ -2379,7 +2379,7 @@
>  
>  void ast_yyfree(void *ptr, yyscan_t yyscanner)
>  {
> -      if (ptr) /* the normal generated ast_yyfree func just frees its first arg;
> +       /* the normal generated ast_yyfree func just frees its first arg;
>                      this get complaints on some systems, as sometimes this
>                      arg is a nil ptr! It's usually not fatal, but is irritating! */
>                free( (char *) ptr );
> @@ -2416,8 +2416,7 @@
>  			else
>  				buf[0] = 0;
>  			return_value = strlen(buf);
> -			if (io.val->u.s)
> -				free(io.val->u.s);
> +			free(io.val->u.s);
>  		}
>  		free(io.val);
>  	}

This is a generated file; these changes need to be made in ast_expr2.fl
as well.

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
skype: kpfleming | jabber: kpfleming at digium.com
Check us out at www.digium.com & www.asterisk.org



More information about the asterisk-dev mailing list