From: Andrey Volk Date: Fri, 12 Jul 2019 16:45:22 +0000 (+0400) Subject: FS-11903: Fix errors reported by PVS-Studio Static Code Analyzer for switch_regex.c X-Git-Tag: v1.10.0~240 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5d8ffcb5e032ae5002290d5c4c16e121f605bd9;p=thirdparty%2Ffreeswitch.git FS-11903: Fix errors reported by PVS-Studio Static Code Analyzer for switch_regex.c --- diff --git a/src/switch_regex.c b/src/switch_regex.c index 5a82e21752..21e54b29fe 100644 --- a/src/switch_regex.c +++ b/src/switch_regex.c @@ -75,7 +75,7 @@ SWITCH_DECLARE(int) switch_regex_perform(const char *field, const char *expressi if (*expression == '/') { char *opts = NULL; tmp = strdup(expression + 1); - assert(tmp); + switch_assert(tmp); if ((opts = strrchr(tmp, '/'))) { *opts++ = '\0'; } else { @@ -85,7 +85,7 @@ SWITCH_DECLARE(int) switch_regex_perform(const char *field, const char *expressi goto end; } expression = tmp; - if (opts) { + if (*opts) { if (strchr(opts, 'i')) { flags |= PCRE_CASELESS; } @@ -227,7 +227,7 @@ SWITCH_DECLARE(switch_status_t) switch_regex_match_partial(const char *target, c if (*expression == '/') { char *opts = NULL; tmp = strdup(expression + 1); - assert(tmp); + switch_assert(tmp); if ((opts = strrchr(tmp, '/'))) { *opts++ = '\0'; } else { @@ -237,7 +237,7 @@ SWITCH_DECLARE(switch_status_t) switch_regex_match_partial(const char *target, c goto end; } expression = tmp; - if (opts) { + if (*opts) { if (strchr(opts, 'i')) { flags |= PCRE_CASELESS; }