summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2019-06-27 08:05:46 +0200
committerWerner Koch <wk@gnupg.org>2019-06-27 08:05:46 +0200
commit382fddc151fd42cd6d1d02dbedb7b5031cc68958 (patch)
treee2447f8431dad3a4e61725fa955f60087d39a287
parent70a5ea407c71cf094794d3d3375aab7fc2c4eca6 (diff)
downloadlibgpg-error-382fddc151fd42cd6d1d02dbedb7b5031cc68958.tar.gz
estream: Add missing malloc check.
* src/estream.c (_gpgrt_poll): Check for malloc error. Signed-off-by: Werner Koch <wk@gnupg.org>
-rw-r--r--src/estream.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/estream.c b/src/estream.c
index 33b9f4d..e1a123e 100644
--- a/src/estream.c
+++ b/src/estream.c
@@ -4336,7 +4336,7 @@ _gpgrt_getline (char *_GPGRT__RESTRICT *_GPGRT__RESTRICT lineptr,
If a line has been truncated, the file pointer is moved forward to
the end of the line so that the next read starts with the next
- line. Note that MAX_LENGTH must be re-initialzied in this case.
+ line. Note that MAX_LENGTH must be re-initialized in this case.
The caller initially needs to provide the address of a variable,
initialized to NULL, at ADDR_OF_BUFFER and don't change this value
@@ -4852,6 +4852,11 @@ _gpgrt_poll (gpgrt_poll_t *fds, unsigned int nfds, int timeout)
#else /*!HAVE_W32_SYSTEM*/
# ifdef HAVE_POLL_H
poll_fds = xtrymalloc (sizeof (*poll_fds)*nfds);
+ if (!poll_fds)
+ {
+ count = -1;
+ goto leave;
+ }
poll_nfds = 0;
for (item = fds, idx = 0; idx < nfds; item++, idx++)
{