[Freeswitch-svn] [commit] r13374 - freeswitch/trunk/src/mod/endpoints/mod_dingaling

FreeSWITCH SVN mikej at freeswitch.org
Mon May 18 07:56:09 PDT 2009


Author: mikej
Date: Mon May 18 09:56:09 2009
New Revision: 13374

Log:
 fix small memory 

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c

Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	Mon May 18 09:56:09 2009
@@ -2093,17 +2093,20 @@
 {
 	char *argv[10] = { 0 };
 	int argc = 0;
-	char *var, *val, *myarg;
+	char *var, *val, *myarg = NULL;
 	mdl_profile_t *profile = NULL;
 	int x;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
 
 	if (session) {
-		return SWITCH_STATUS_FALSE;
+		status = SWITCH_STATUS_FALSE;
+		goto done;
 	}
 
 	if (switch_strlen_zero(cmd)) {
 		stream->write_function(stream, "USAGE: %s\n", LOGIN_SYNTAX);
-		return SWITCH_STATUS_SUCCESS;
+		status = SWITCH_STATUS_SUCCESS;
+		goto done;
 	}
 
 	myarg = strdup(cmd);
@@ -2112,7 +2115,8 @@
 
 	if (switch_strlen_zero(cmd) || argc != 1) {
 		stream->write_function(stream, "USAGE: %s\n", LOGIN_SYNTAX);
-		return SWITCH_STATUS_SUCCESS;
+		status = SWITCH_STATUS_SUCCESS;
+		goto done;
 	}
 
 	if (argv[0] && !strncasecmp(argv[0], "profile=", 8)) {
@@ -2123,7 +2127,8 @@
 			if (switch_test_flag(profile, TFLAG_IO)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile already exists.\n");
 				stream->write_function(stream, "Profile already exists\n");
-				return SWITCH_STATUS_SUCCESS;
+				status = SWITCH_STATUS_SUCCESS;
+				goto done;
 			}
 
 		}
@@ -2145,9 +2150,10 @@
 	} else {
 		stream->write_function(stream, "FAIL\n");
 	}
+ done:
+	switch_safe_free(myarg);
 
-	return SWITCH_STATUS_SUCCESS;
-
+	return status;
 }
 
 static switch_status_t load_config(void)



More information about the Freeswitch-svn mailing list