aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2019-06-27 06:05:46 +0000
committerWerner Koch <[email protected]>2019-06-27 06:05:46 +0000
commit382fddc151fd42cd6d1d02dbedb7b5031cc68958 (patch)
treee2447f8431dad3a4e61725fa955f60087d39a287
parentestream: Don't use variable length array. (diff)
downloadlibgpg-error-382fddc151fd42cd6d1d02dbedb7b5031cc68958.tar.gz
libgpg-error-382fddc151fd42cd6d1d02dbedb7b5031cc68958.zip
estream: Add missing malloc check.
* src/estream.c (_gpgrt_poll): Check for malloc error. Signed-off-by: Werner Koch <[email protected]>
-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++)
{