[Freeswitch-svn] [commit] r9347 - in freeswitch/trunk/src: . mod/applications/mod_commands

Freeswitch SVN anthm at freeswitch.org
Fri Aug 22 13:00:17 EDT 2008


Author: anthm
Date: Fri Aug 22 13:00:16 2008
New Revision: 9347

Modified:
   freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
   freeswitch/trunk/src/switch_event.c
   freeswitch/trunk/src/switch_xml.c

Log:
valgrind

Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	Fri Aug 22 13:00:16 2008
@@ -2047,6 +2047,7 @@
 	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 @@
 
 	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 @@
 	/* 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 @@
 		}
 	} else {
 		stream->write_function(stream, "-USAGE: %s\n", SHOW_SYNTAX);
-		return SWITCH_STATUS_SUCCESS;
+		goto end;
 	}
 
 	holder.stream = stream;
@@ -2212,9 +2213,15 @@
 		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)

Modified: freeswitch/trunk/src/switch_event.c
==============================================================================
--- freeswitch/trunk/src/switch_event.c	(original)
+++ freeswitch/trunk/src/switch_event.c	Fri Aug 22 13:00:16 2008
@@ -417,6 +417,9 @@
 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 @@
 		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();

Modified: freeswitch/trunk/src/switch_xml.c
==============================================================================
--- freeswitch/trunk/src/switch_xml.c	(original)
+++ freeswitch/trunk/src/switch_xml.c	Fri Aug 22 13:00:16 2008
@@ -1099,6 +1099,7 @@
 			}
 			fprintf(stderr, "Error including %s (%s)\n", pattern, reason);
 		}
+		free(dir_path);
 	}
     globfree(&glob_data);
 



More information about the Freeswitch-svn mailing list