[Freeswitch-svn] [commit] r8445 - freeswitch/trunk/src

Freeswitch SVN mikej at freeswitch.org
Fri May 16 13:25:43 EDT 2008


Author: mikej
Date: Fri May 16 13:25:43 2008
New Revision: 8445

Modified:
   freeswitch/trunk/src/switch_event.c

Log:
handle edgecase leak on platforms without vasprintf. Found by Klockwork (www.klocwork.com)


Modified: freeswitch/trunk/src/switch_event.c
==============================================================================
--- freeswitch/trunk/src/switch_event.c	(original)
+++ freeswitch/trunk/src/switch_event.c	Fri May 16 13:25:43 2008
@@ -863,11 +863,14 @@
 		ret = vasprintf(&data, fmt, ap);
 #else
 		data = (char *) malloc(2048);
-		switch_assert(data);
+		if (!data) return NULL;
 		ret = vsnprintf(data, 2048, fmt, ap);
 #endif
 		va_end(ap);
 		if (ret == -1) {
+#ifndef HAVE_VASPRINTF
+			free(data);
+#endif
 			return NULL;
 		}
 	}



More information about the Freeswitch-svn mailing list