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

Freeswitch SVN mikej at freeswitch.org
Mon May 19 14:43:02 EDT 2008


Author: mikej
Date: Mon May 19 14:43:01 2008
New Revision: 8468

Modified:
   freeswitch/trunk/src/switch_utils.c

Log:
don't deref NULL. Found by Klockwork (www.klocwork.com)

Modified: freeswitch/trunk/src/switch_utils.c
==============================================================================
--- freeswitch/trunk/src/switch_utils.c	(original)
+++ freeswitch/trunk/src/switch_utils.c	Mon May 19 14:43:01 2008
@@ -568,12 +568,16 @@
 	const char *sp = str;
 	char *p, *s = NULL;
 	
-	while(sp && *sp && *sp == ' ') {
+	if (!sp) return NULL;
+
+	while(*sp == ' ') {
 		sp++;
 	}
 	
 	s = strdup(sp);
 
+	if (!s) return NULL;
+
 	p = s + (strlen(s) - 1);
 
 	while(*p == ' ') {



More information about the Freeswitch-svn mailing list