]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
valgrind
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 22 Aug 2008 17:00:16 +0000 (17:00 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 22 Aug 2008 17:00:16 +0000 (17:00 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9347 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_commands/mod_commands.c
src/switch_event.c
src/switch_xml.c

index 89691687e517bcce47e2840da46b967c48db8c8a..d0ef245200659ffb35546b58773c127c3745263d 100644 (file)
@@ -2047,6 +2047,7 @@ SWITCH_STANDARD_API(show_function)
        int argc;
        char *command = NULL, *as = NULL;
        switch_core_flag_t cflags = switch_core_flags();
+       switch_status_t status = SWITCH_STATUS_SUCCESS;
 
        if (session) {
                return SWITCH_STATUS_FALSE;
@@ -2083,7 +2084,7 @@ SWITCH_STANDARD_API(show_function)
 
        if (!(cflags & SCF_USE_SQL) && command && !strcasecmp(command, "channels")) {
                stream->write_function(stream, "-ERR SQL DISABLED NO CHANNEL DATA AVAILABLE!\n");
-               return SWITCH_STATUS_SUCCESS;
+               goto end;
        }
 
 
@@ -2091,7 +2092,7 @@ SWITCH_STANDARD_API(show_function)
        /* statmements, you must also change show_callback and friends to match! */
        if (!command) {
                stream->write_function(stream, "-USAGE: %s\n", SHOW_SYNTAX);
-               return SWITCH_STATUS_SUCCESS;
+               goto end;
        } else if (!strncasecmp(command, "codec", 5) || 
                           !strncasecmp(command, "dialplan", 8) || 
                           !strncasecmp(command, "file", 4) || 
@@ -2146,7 +2147,7 @@ SWITCH_STANDARD_API(show_function)
                }
        } else {
                stream->write_function(stream, "-USAGE: %s\n", SHOW_SYNTAX);
-               return SWITCH_STATUS_SUCCESS;
+               goto end;
        }
 
        holder.stream = stream;
@@ -2212,9 +2213,15 @@ SWITCH_STANDARD_API(show_function)
                holder.stream->write_function(holder.stream, "-ERR Cannot find format %s\n", as);
        }
 
+ end:
+
        switch_safe_free(mydata);
-       switch_core_db_close(db);
-       return SWITCH_STATUS_SUCCESS;
+
+       if (db) {
+               switch_core_db_close(db);
+       }
+
+       return status;
 }
 
 SWITCH_STANDARD_API(version_function)
index 12f6f88b825ca93593611a6dece80eaa4b393b86..eabb15eac452c1be4c6b1810b32bc0f83a78a821 100644 (file)
@@ -417,6 +417,9 @@ SWITCH_DECLARE(void) switch_core_memory_reclaim_events(void)
 SWITCH_DECLARE(switch_status_t) switch_event_shutdown(void)
 {
        int x = 0, last = 0;
+       switch_hash_index_t *hi;
+       const void *var;
+    void *val;
 
        switch_mutex_lock(EVENT_QUEUE_MUTEX);
        SYSTEM_RUNNING = 0;
@@ -440,6 +443,15 @@ SWITCH_DECLARE(switch_status_t) switch_event_shutdown(void)
                last = THREAD_COUNT;
        }
 
+       for (hi = switch_hash_first(NULL, CUSTOM_HASH); hi; hi = switch_hash_next(hi)) {
+               switch_event_subclass_t *subclass;
+               switch_hash_this(hi, &var, NULL, &val);;
+               if ((subclass = (switch_event_subclass_t *) val)) {
+                       FREE(subclass->name);
+                       FREE(subclass->owner);
+                       FREE(subclass);
+               }
+       }
 
        switch_core_hash_destroy(&CUSTOM_HASH);
        switch_core_memory_reclaim_events();
index 5ed5f1075932efa251f5498e59a54af9a7696f5f..eb25242097a50d2a200ff3684a044a63e830e58b 100644 (file)
@@ -1099,6 +1099,7 @@ static int preprocess_glob(const char *cwd, const char *pattern, int write_fd, i
                        }
                        fprintf(stderr, "Error including %s (%s)\n", pattern, reason);
                }
+               free(dir_path);
        }
     globfree(&glob_data);