From cvs-return-3956-apmail-apr-cvs-archive=apr.apache.org@apr.apache.org Fri Aug 02 18:51:54 2002 Return-Path: Delivered-To: apmail-apr-cvs-archive@apr.apache.org Received: (qmail 62792 invoked by uid 500); 2 Aug 2002 18:51:54 -0000 Mailing-List: contact cvs-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: dev@apr.apache.org Delivered-To: mailing list cvs@apr.apache.org Received: (qmail 62780 invoked from network); 2 Aug 2002 18:51:54 -0000 Date: 2 Aug 2002 18:51:53 -0000 Message-ID: <20020802185153.85428.qmail@icarus.apache.org> From: wrowe@apache.org To: apr-cvs@apache.org Subject: cvs commit: apr/poll/unix poll.c X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N wrowe 2002/08/02 11:51:53 Modified: poll/unix poll.c Log: We safely ignore palloc failures [we can segv in the allocator]. We cannot ignore alloca/malloc failures. Revision Changes Path 1.19 +8 -0 apr/poll/unix/poll.c Index: poll.c =================================================================== RCS file: /home/cvs/apr/poll/unix/poll.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- poll.c 2 Aug 2002 18:29:29 -0000 1.18 +++ poll.c 2 Aug 2002 18:51:53 -0000 1.19 @@ -114,9 +114,12 @@ { int i; #ifdef HAVE_VLA + /* XXX: I trust that this is a segv when insufficient stack exists? */ struct pollfd pollset[num]; #elif defined(HAVE_ALLOCA) struct pollfd *pollset = alloca(sizeof(pollfd) * num); + if (!pollset) + return APR_ENOMEM; #else struct pollfd tmp_pollset[SMALL_POLLSET_LIMIT]; struct pollfd *pollset; @@ -129,6 +132,11 @@ * mapping. */ pollset = malloc(sizeof(struct pollfd) * num); + /* The other option is adding an apr_pool_abort() fn to invoke + * the pool's out of memory handler + */ + if (!pollset) + return APR_ENOMEM; } #endif for (i = 0; i < num; i++) {