From: Michael Jerris Date: Thu, 15 May 2014 13:47:24 +0000 (+0000) Subject: CID:1214200 Dereference null return value X-Git-Tag: v1.4.4~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0469db03050aff5f819a6c0453ad561a92ba0a2e;p=thirdparty%2Ffreeswitch.git CID:1214200 Dereference null return value --- diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c index 3c549c60e0..dc48c34b44 100644 --- a/src/mod/applications/mod_httapi/mod_httapi.c +++ b/src/mod/applications/mod_httapi/mod_httapi.c @@ -1499,22 +1499,32 @@ static switch_status_t httapi_sync(client_t *client) char *r, *q, *p = strstr(dynamic_url, "://"); use_url++; - dup_creds = strdup(p+3); + if (p) { + dup_creds = strdup(p+3); - if ((q = strchr(dup_creds, '@'))) *q = '\0'; + if ((q = strchr(dup_creds, '@'))) *q = '\0'; - q = strdup(url); - r = strchr(q, '@'); - r++; + q = strdup(url); - if ((p = strstr(q, "://"))) { - *(p+3) = '\0'; - } + if (q) { + r = strchr(q, '@'); + + if (r) { + r++; + + if ((p = strstr(q, "://"))) { + *(p+3) = '\0'; + } - p = switch_mprintf("%s%s", q, r); - free(dynamic_url); - dynamic_url = p; - free(q); + p = switch_mprintf("%s%s", q, r); + if (p) { + free(dynamic_url); + dynamic_url = p; + } + } + free(q); + } + } }