From baadc811a703b9a6dec655c7afb3218d8cff51fa Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 16 Mar 2014 20:02:37 +0100 Subject: [PATCH 11/11] channel_receive_window_adjust: store windows size always Avoid it sometimes returning without storing it, leaving calling functions with unknown content! Detected by clang-analyzer [upstream commit fcb601da7b37c6e9bbcd264199597e2ddb7bc347] Signed-off-by: Kamil Dudka --- src/channel.c | 11 ++++------- 1 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/channel.c b/src/channel.c index 36c75d2..1d074df 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1,6 +1,6 @@ /* Copyright (c) 2004-2007 Sara Golemon * Copyright (c) 2005 Mikhail Gusarov - * Copyright (c) 2008-2011 by Daniel Stenberg + * Copyright (c) 2008-2014 by Daniel Stenberg * * All rights reserved. * @@ -1544,6 +1544,9 @@ _libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL * channel, { int rc; + if(store) + *store = channel->remote.window_size; + if (channel->adjust_state == libssh2_NB_state_idle) { if (!force && (adjustment + channel->adjust_queue < @@ -1553,14 +1556,10 @@ _libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL * channel, "for channel %lu/%lu", adjustment, channel->local.id, channel->remote.id); channel->adjust_queue += adjustment; - if(store) - *store = channel->remote.window_size; return 0; } if (!adjustment && !channel->adjust_queue) { - if(store) - *store = channel->remote.window_size; return 0; } @@ -1598,8 +1597,6 @@ _libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL * channel, channel->adjust_state = libssh2_NB_state_idle; - if(store) - *store = channel->remote.window_size; return 0; } -- 1.7.1