]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Check pointers before freeing (was getting WARNINGS under MALLOC_DEBUG)
authorTerry Wilson <twilson@digium.com>
Thu, 10 Jan 2008 19:03:04 +0000 (19:03 +0000)
committerTerry Wilson <twilson@digium.com>
Thu, 10 Jan 2008 19:03:04 +0000 (19:03 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@97825 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/ast_expr2f.c
main/cli.c

index 57eb2dd5bb8bd5d9afe3a34c231a3fcbbc55a137..9f5e5cf4f44cf076bf2058cde3568b6ccbcb68d7 100644 (file)
@@ -3963,7 +3963,8 @@ void *ast_yyrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
 
 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"
index 72cd8152f44096c59b52ec83248aaba30309c03a..8813c6a3f206b36c7f815d3d82381080c570320f 100644 (file)
@@ -135,7 +135,8 @@ static char *complete_fn(const char *word, int state)
                c += (strlen(ast_config_AST_MODULE_DIR) + 1);
        if (c)
                c = ast_strdup(c);
-       free(d);
+       if (d)
+               free(d);
        
        return c;
 }