From: Michael Jerris Date: Mon, 19 May 2008 18:43:01 +0000 (+0000) Subject: don't deref NULL. Found by Klockwork (www.klocwork.com) X-Git-Tag: v1.0-rc6~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=41a0bc8fb60036ce10b7355f48ea6f5ebbac1bfb;p=thirdparty%2Ffreeswitch.git don't deref NULL. Found by Klockwork (www.klocwork.com) git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8468 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- diff --git a/src/switch_utils.c b/src/switch_utils.c index d64dae7829..b59bbfffcb 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -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 == ' ') {