[asterisk-commits] twilson: trunk r97825 - in /trunk/main: ast_expr2f.c cli.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 10 13:03:05 CST 2008


Author: twilson
Date: Thu Jan 10 13:03:04 2008
New Revision: 97825

URL: http://svn.digium.com/view/asterisk?view=rev&rev=97825
Log:
Check pointers before freeing (was getting WARNINGS under MALLOC_DEBUG)

Modified:
    trunk/main/ast_expr2f.c
    trunk/main/cli.c

Modified: trunk/main/ast_expr2f.c
URL: http://svn.digium.com/view/asterisk/trunk/main/ast_expr2f.c?view=diff&rev=97825&r1=97824&r2=97825
==============================================================================
--- trunk/main/ast_expr2f.c (original)
+++ trunk/main/ast_expr2f.c Thu Jan 10 13:03:04 2008
@@ -3963,7 +3963,8 @@
 
 void ast_yyfree (void * ptr , yyscan_t yyscanner)
 {
-	free( (char *) ptr );	/* see ast_yyrealloc() for (char *) cast */
+	if (ptr)
+		free( (char *) ptr );	/* see ast_yyrealloc() for (char *) cast */
 }
 
 #define YYTABLES_NAME "yytables"

Modified: trunk/main/cli.c
URL: http://svn.digium.com/view/asterisk/trunk/main/cli.c?view=diff&rev=97825&r1=97824&r2=97825
==============================================================================
--- trunk/main/cli.c (original)
+++ trunk/main/cli.c Thu Jan 10 13:03:04 2008
@@ -135,7 +135,8 @@
 		c += (strlen(ast_config_AST_MODULE_DIR) + 1);
 	if (c)
 		c = ast_strdup(c);
-	free(d);
+	if (d)
+		free(d);
 	
 	return c;
 }




More information about the asterisk-commits mailing list