[asterisk-commits] russell: branch russell/autoservice-nochans-1.4 r105559 - /team/russell/autos...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Mar 3 09:17:31 CST 2008


Author: russell
Date: Mon Mar  3 09:17:31 2008
New Revision: 105559

URL: http://svn.digium.com/view/asterisk?view=rev&rev=105559
Log:
Don't alloca(0) and pass the result as the first arg to poll() in the case that
a waitfor function is called with nothing to actually poll on.

(inspired by issue #12116)

Modified:
    team/russell/autoservice-nochans-1.4/main/channel.c

Modified: team/russell/autoservice-nochans-1.4/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoservice-nochans-1.4/main/channel.c?view=diff&rev=105559&r1=105558&r2=105559
==============================================================================
--- team/russell/autoservice-nochans-1.4/main/channel.c (original)
+++ team/russell/autoservice-nochans-1.4/main/channel.c Mon Mar  3 09:17:31 2008
@@ -1616,7 +1616,7 @@
 	int *exception, int *outfd, int *ms)
 {
 	struct timeval start = { 0 , 0 };
-	struct pollfd *pfds;
+	struct pollfd *pfds = NULL;
 	int res;
 	long rms;
 	int x, y, max;
@@ -1627,11 +1627,12 @@
 	struct fdmap {
 		int chan;
 		int fdno;
-	} *fdmap;
-
-	sz = n * AST_MAX_FDS + nfds;
-	pfds = alloca(sizeof(*pfds) * sz);
-	fdmap = alloca(sizeof(*fdmap) * sz);
+	} *fdmap = NULL;
+
+	if ((sz = n * AST_MAX_FDS + nfds)) {
+		pfds = alloca(sizeof(*pfds) * sz);
+		fdmap = alloca(sizeof(*fdmap) * sz);
+	}
 
 	if (outfd)
 		*outfd = -99999;




More information about the asterisk-commits mailing list