From 78b55553fd160e607e7b850f792402b8c536fb25 Mon Sep 17 00:00:00 2001 From: Mark Michelson Date: Wed, 19 Nov 2008 01:00:44 +0000 Subject: [PATCH] Merged revisions 157632 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ........ r157632 | mmichelson | 2008-11-18 18:59:48 -0600 (Tue, 18 Nov 2008) | 10 lines If malloc returns NULL, we need to return NULL immediately or else Asterisk will crash when attempting to dereference the NULL pointer (closes issue #13858) Reported by: eliel Patches: astmm.c.patch uploaded by eliel (license 64) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@157636 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/astmm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/main/astmm.c b/main/astmm.c index f5191c2e51..e72c1e318d 100644 --- a/main/astmm.c +++ b/main/astmm.c @@ -114,6 +114,7 @@ static inline void *__ast_alloc_region(size_t size, const enum func_type which, if (!(reg = malloc(size + sizeof(*reg) + sizeof(*fence)))) { astmm_log("Memory Allocation Failure - '%d' bytes in function %s " "at line %d of %s\n", (int) size, func, lineno, file); + return NULL; } ast_copy_string(reg->file, file, sizeof(reg->file));