diff options
author | dvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-06-18 16:51:54 +0000 |
---|---|---|
committer | dvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-06-18 16:51:54 +0000 |
commit | f789484094473a3914d3cd4d99ea8950e32c15ef (patch) | |
tree | 1f8b8565fdaccde4115c617c6c1381ab56ad4dca /main | |
parent | 0816d31618f6656fcdd348220f863a1635716bc4 (diff) |
Merged revisions 201678 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r201678 | dvossel | 2009-06-18 11:37:42 -0500 (Thu, 18 Jun 2009) | 11 lines
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
........
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@201680 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/ast_expr2.c | 1 | ||||
-rw-r--r-- | main/ast_expr2f.c | 5 | ||||
-rw-r--r-- | main/asterisk.c | 3 |
3 files changed, 4 insertions, 5 deletions
diff --git a/main/ast_expr2.c b/main/ast_expr2.c index 44b0b7ece..068e47acd 100644 --- a/main/ast_expr2.c +++ b/main/ast_expr2.c @@ -2415,6 +2415,7 @@ static void free_value (struct val *vp) { if (vp==NULL) { + free(vp); return; } if (vp->type == AST_EXPR_string || vp->type == AST_EXPR_numeric_string) diff --git a/main/ast_expr2f.c b/main/ast_expr2f.c index 528afd9ae..91793b630 100644 --- a/main/ast_expr2f.c +++ b/main/ast_expr2f.c @@ -2379,7 +2379,7 @@ int ast_yyerror(const char *, YYLTYPE *, struct parse_io *); /* likewise */ 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 ); @@ -2423,8 +2423,7 @@ int ast_expr(char *expr, char *buf, int length, struct ast_channel *chan) 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); } diff --git a/main/asterisk.c b/main/asterisk.c index 42e091ede..1ae468cec 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -802,8 +802,7 @@ void ast_unregister_atexit(void (*func)(void)) AST_RWLIST_TRAVERSE_SAFE_END; AST_RWLIST_UNLOCK(&atexits); - if (ae) - free(ae); + free(ae); } /* Sending commands from consoles back to the daemon requires a terminating NULL */ |