Check pointers before freeing (was getting WARNINGS under MALLOC_DEBUG)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@97825 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Terry Wilson
2008-01-10 19:03:04 +00:00
parent 222917317d
commit e823e89b5a
2 changed files with 4 additions and 2 deletions

View 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"

View 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;
}