1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-08-10 06:23:01 +03:00

poll: Fix sizeof in ssh_poll_ctx_resize().

sizeof(ssh_poll_handle *) is to be equal to sizeof(ssh_poll_handle), but
this is not a portable assumption.

Found by Coverity.
This commit is contained in:
Andreas Schneider
2012-10-08 22:13:28 +02:00
parent 46f22576b0
commit de34a64895

View File

@@ -460,14 +460,14 @@ static int ssh_poll_ctx_resize(ssh_poll_ctx ctx, size_t new_size) {
ssh_poll_handle *pollptrs; ssh_poll_handle *pollptrs;
ssh_pollfd_t *pollfds; ssh_pollfd_t *pollfds;
pollptrs = realloc(ctx->pollptrs, sizeof(ssh_poll_handle *) * new_size); pollptrs = realloc(ctx->pollptrs, sizeof(ssh_poll_handle) * new_size);
if (pollptrs == NULL) { if (pollptrs == NULL) {
return -1; return -1;
} }
pollfds = realloc(ctx->pollfds, sizeof(ssh_pollfd_t) * new_size); pollfds = realloc(ctx->pollfds, sizeof(ssh_pollfd_t) * new_size);
if (pollfds == NULL) { if (pollfds == NULL) {
ctx->pollptrs = realloc(pollptrs, sizeof(ssh_poll_handle *) * ctx->polls_allocated); ctx->pollptrs = realloc(pollptrs, sizeof(ssh_poll_handle) * ctx->polls_allocated);
return -1; return -1;
} }