]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11903: Fix errors reported by PVS-Studio Static Code Analyzer for switch_core.c
authorAndrey Volk <andywolk@gmail.com>
Fri, 12 Jul 2019 16:38:59 +0000 (20:38 +0400)
committerAndrey Volk <andywolk@gmail.com>
Mon, 15 Jul 2019 19:41:14 +0000 (23:41 +0400)
src/switch_core.c

index d81b7e520c4f1a52affc69cca6cc1d2352a55f07..e03a041200a65a6a704cc63b3b9e5b4b1cc8f4b9 100644 (file)
@@ -1307,11 +1307,7 @@ static void load_mime_types(void)
        }
 
        switch_safe_free(line_buf);
-
-       if (fd) {
-               fclose(fd);
-               fd = NULL;
-       }
+       fclose(fd);
 
   end:
 
@@ -2649,6 +2645,7 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void *
 
                        if (!zstr(arg)) {
                                tech = strdup(arg);
+                               switch_assert(tech);
 
                                if ((prof = strchr(tech, ':'))) {
                                        *prof++ = '\0';
@@ -2656,10 +2653,9 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void *
 
                                if (!strcasecmp(tech, "flush")) {
                                        flush++;
-                                       tech = NULL;
 
                                        if (prof) {
-                                               tech = prof;
+                                               char *tech = prof;
                                                if ((prof = strchr(tech, ':'))) {
                                                        *prof++ = '\0';
                                                }