diff options
author | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2002-08-02 18:51:53 +0000 |
---|---|---|
committer | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2002-08-02 18:51:53 +0000 |
commit | 5bacf014cfb26eeffe114716fce17cdee5667cab (patch) | |
tree | 34bc527952af1c7496f54f80f97fea86f25c85d0 /poll | |
parent | b288a0535ecb9fe258c23f820bc24cb1f5516751 (diff) | |
download | libapr-5bacf014cfb26eeffe114716fce17cdee5667cab.tar.gz |
We safely ignore palloc failures [we can segv in the allocator].
We cannot ignore alloca/malloc failures.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63771 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poll')
-rw-r--r-- | poll/unix/poll.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/poll/unix/poll.c b/poll/unix/poll.c index b63645e1d..a6f25e353 100644 --- a/poll/unix/poll.c +++ b/poll/unix/poll.c @@ -114,9 +114,12 @@ APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t num, { 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 @@ APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t num, * 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++) { |