vte r2357 - in trunk: . gnome-pty-helper



Author: haltonhuo
Date: Fri Dec 26 14:48:23 2008
New Revision: 2357
URL: http://svn.gnome.org/viewvc/vte?rev=2357&view=rev

Log:
2008-12-26  Halton Huo  <halton huo sun com>

	Bug 565679 - alloca is discouraged

	* gnome-pty-helper/gnome-pty-helper.c: use malloc replace alloca.



Modified:
   trunk/ChangeLog
   trunk/gnome-pty-helper/gnome-pty-helper.c

Modified: trunk/gnome-pty-helper/gnome-pty-helper.c
==============================================================================
--- trunk/gnome-pty-helper/gnome-pty-helper.c	(original)
+++ trunk/gnome-pty-helper/gnome-pty-helper.c	Fri Dec 26 14:48:23 2008
@@ -462,7 +462,7 @@
 	struct group *group_info;
 	struct termios term;
 
-	term_name = (char *) alloca (path_max () + 1);
+	term_name = (char *) malloc (path_max () + 1);
 
 	if (term_name == NULL) {
 		exit (1);
@@ -501,6 +501,7 @@
 	if (status == -1) {
 		result = 0;
 		n_write (STDIN_FILENO, &result, sizeof (result));
+		free (term_name);
 		return 0;
 	}
 
@@ -520,6 +521,7 @@
 	    n_write (STDIN_FILENO, &p, sizeof (p)) != sizeof (p) ||
 	    pass_fd (STDOUT_FILENO, master_pty)  == -1 ||
 	    pass_fd (STDOUT_FILENO, slave_pty)   == -1) {
+		free (term_name);
 		exit (0);
 	}
 
@@ -530,6 +532,7 @@
 
 	close (master_pty);
 	close (slave_pty);
+	free (term_name);
 
 	return 1;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]