From: Russell Bryant Date: Tue, 5 Jun 2007 17:07:30 +0000 (+0000) Subject: Handle a failure in malloc() in ast_safe_string_alloc() X-Git-Tag: 1.4.5~69 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9dd7be2f58b1805c532a6791050fdfb79105ef60;p=thirdparty%2Fasterisk.git Handle a failure in malloc() in ast_safe_string_alloc() git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@67372 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/channel.c b/main/channel.c index 71214a0e45..71c1e0a449 100644 --- a/main/channel.c +++ b/main/channel.c @@ -435,7 +435,8 @@ char *ast_safe_string_alloc(const char *fmt, ...) len = vsnprintf(buf, 1, fmt, args); va_end(args); - b2 = ast_malloc(len + 1); + if (!(b2 = ast_malloc(len + 1))) + return NULL; va_start(args, fmt); vsnprintf(b2, len + 1, fmt, args);