forked from Mirrors/freeswitch
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
This commit is contained in:
parent
5e7e1b999d
commit
41a0bc8fb6
@ -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 == ' ') {
|
||||
|
Loading…
Reference in New Issue
Block a user