]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
don't deref NULL. Found by Klockwork (www.klocwork.com)
authorMichael Jerris <mike@jerris.com>
Mon, 19 May 2008 18:43:01 +0000 (18:43 +0000)
committerMichael Jerris <mike@jerris.com>
Mon, 19 May 2008 18:43:01 +0000 (18:43 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8468 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_utils.c

index d64dae7829a452679506502b0f56143c33604099..b59bbfffcb0b5985cc0b3259c6fce847c50ce984 100644 (file)
@@ -568,12 +568,16 @@ SWITCH_DECLARE(char *) switch_strip_spaces(const char *str)
        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 == ' ') {