aboutsummaryrefslogtreecommitdiffstats
path: root/main/astobj2.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-28 15:35:23 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-28 15:35:23 +0000
commit7e7b82276dae7b2f51af7ab1195a2926f761aa93 (patch)
treeccd75c3d71febe30e9333c58f5acfa463b350934 /main/astobj2.c
parent5a0851702a9261f82de75dd7ad787c81c92370e3 (diff)
Eliminate several needless checks and fix a few memory leaks
(closes issue #14833) Reported by: contactmayankjain Patches: all_changes.patch uploaded by contactmayankjain (license 740) slightly modified by me git-svn-id: http://svn.digium.com/svn/asterisk/trunk@197616 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/astobj2.c')
-rw-r--r--main/astobj2.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/main/astobj2.c b/main/astobj2.c
index 13e0c54b2..91ec1428c 100644
--- a/main/astobj2.c
+++ b/main/astobj2.c
@@ -342,11 +342,11 @@ void *__ao2_alloc_debug(size_t data_size, ao2_destructor_fn destructor_fn, char
void *obj;
FILE *refo = ref_debug ? fopen(REF_FILE,"a") : NULL;
- obj = internal_ao2_alloc(data_size, destructor_fn, file, line, funcname);
-
- if (obj == NULL)
+ if ((obj = internal_ao2_alloc(data_size, destructor_fn, file, line, funcname)) == NULL) {
+ fclose(refo);
return NULL;
-
+ }
+
if (refo) {
fprintf(refo, "%p =1 %s:%d:%s (%s)\n", obj, file, line, funcname, tag);
fclose(refo);