[asterisk-commits] mmichelson: trunk r157632 - /trunk/main/astmm.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Nov 18 18:59:49 CST 2008


Author: mmichelson
Date: Tue Nov 18 18:59:48 2008
New Revision: 157632

URL: http://svn.digium.com/view/asterisk?view=rev&rev=157632
Log:
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)


Modified:
    trunk/main/astmm.c

Modified: trunk/main/astmm.c
URL: http://svn.digium.com/view/asterisk/trunk/main/astmm.c?view=diff&rev=157632&r1=157631&r2=157632
==============================================================================
--- trunk/main/astmm.c (original)
+++ trunk/main/astmm.c Tue Nov 18 18:59:48 2008
@@ -114,6 +114,7 @@
 	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));




More information about the asterisk-commits mailing list