[Asterisk-cvs] asterisk/apps app_festival.c,1.26,1.26.2.1

russell at lists.digium.com russell at lists.digium.com
Sat Oct 16 12:04:20 CDT 2004


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv27072/apps

Modified Files:
      Tag: v1-0
	app_festival.c 
Log Message:
call ast_destroy on cfg appropriately (bug #2661)


Index: app_festival.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_festival.c,v
retrieving revision 1.26
retrieving revision 1.26.2.1
diff -u -d -r1.26 -r1.26.2.1
--- app_festival.c	27 Sep 2004 05:06:22 -0000	1.26
+++ app_festival.c	16 Oct 2004 16:04:17 -0000	1.26.2.1
@@ -305,9 +305,9 @@
 	if (!(festivalcommand = ast_variable_retrieve(cfg, "general", "festivalcommand"))) {
 		festivalcommand = "(tts_textasterisk \"%s\" 'file)(quit)\n";
 	}
-	ast_destroy(cfg);
 	if (!vdata || ast_strlen_zero(vdata)) {
 		ast_log(LOG_WARNING, "festival requires an argument (text)\n");
+		ast_destroy(cfg);
 		return -1;
 	}
 	strncpy(data, vdata, sizeof(data) - 1);
@@ -325,6 +325,7 @@
 
     	if (fd < 0) {
 		ast_log(LOG_WARNING,"festival_client: can't get socket\n");
+		ast_destroy(cfg);
         	return -1;
 	}
         memset(&serv_addr, 0, sizeof(serv_addr));
@@ -333,6 +334,7 @@
 	        serverhost = ast_gethostbyname(host, &ahp);
 	        if (serverhost == (struct hostent *)0) {
         	    	ast_log(LOG_WARNING,"festival_client: gethostbyname failed\n");
+			ast_destroy(cfg);
 	            	return -1;
         	}
 	        memmove(&serv_addr.sin_addr,serverhost->h_addr, serverhost->h_length);
@@ -342,6 +344,7 @@
 
 	if (connect(fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) != 0) {
 		ast_log(LOG_WARNING,"festival_client: connect to server failed\n");
+		ast_destroy(cfg);
         	return -1;
     	}
     	
@@ -444,6 +447,7 @@
     		}
 	} while (strcmp(ack,"OK\n") != 0);
 	close(fd);
+	ast_destroy(cfg);
 	LOCAL_USER_REMOVE(u);                                                                                
 	return res;
 




More information about the svn-commits mailing list