diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2013-11-09 13:27:59 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2013-11-13 16:29:41 +0100 |
commit | cd992a90fb1ccba6f4b5f5b0a4bb61ef44ea3b3b (patch) | |
tree | ac6cba46dac636dddfcfb68188ba17cab9be7cf4 /src/poll.c | |
parent | 6ea111fd8a703e701e645fdb182920c8f3ff0d9b (diff) | |
download | libssh-cd992a90fb1ccba6f4b5f5b0a4bb61ef44ea3b3b.tar.gz libssh-cd992a90fb1ccba6f4b5f5b0a4bb61ef44ea3b3b.tar.xz libssh-cd992a90fb1ccba6f4b5f5b0a4bb61ef44ea3b3b.zip |
poll: Fix realloc in ssh_poll_ctx_resize().
Diffstat (limited to 'src/poll.c')
-rw-r--r-- | src/poll.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -472,14 +472,18 @@ static int ssh_poll_ctx_resize(ssh_poll_ctx ctx, size_t new_size) { if (pollptrs == NULL) { return -1; } + ctx->pollptrs = pollptrs; pollfds = realloc(ctx->pollfds, sizeof(ssh_pollfd_t) * new_size); if (pollfds == NULL) { - ctx->pollptrs = realloc(pollptrs, sizeof(ssh_poll_handle) * ctx->polls_allocated); + pollptrs = realloc(ctx->pollptrs, sizeof(ssh_poll_handle) * ctx->polls_allocated); + if (pollptrs == NULL) { + return -1; + } + ctx->pollptrs = pollptrs; return -1; } - ctx->pollptrs = pollptrs; ctx->pollfds = pollfds; ctx->polls_allocated = new_size; |