From: zihao.jiang Date: Mon, 6 Apr 2015 16:24:08 +0000 (+0800) Subject: transport_write sometimes returns directly without cleanup. Fix code path to always... X-Git-Tag: 2.0.0-beta1+android10~603^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a057526f1e426211838b1280a7e8119b379695b6;p=platform%2Fupstream%2Ffreerdp.git transport_write sometimes returns directly without cleanup. Fix code path to always do cleanup job. --- diff --git a/libfreerdp/core/transport.c b/libfreerdp/core/transport.c index ffda7e2..2ffb757 100644 --- a/libfreerdp/core/transport.c +++ b/libfreerdp/core/transport.c @@ -591,16 +591,17 @@ int transport_write(rdpTransport* transport, wStream* s) * is a SSL or TSG BIO in the chain. */ if (!BIO_should_retry(transport->frontBio)) - return status; + goto out_cleanup; /* non-blocking can live with blocked IOs */ if (!transport->blocking) - return status; + goto out_cleanup; if (BIO_wait_write(transport->frontBio, 100) < 0) { WLog_ERR(TAG, "error when selecting for write"); - return -1; + status = -1; + goto out_cleanup; } continue; @@ -613,13 +614,15 @@ int transport_write(rdpTransport* transport, wStream* s) if (BIO_wait_write(transport->frontBio, 100) < 0) { WLog_ERR(TAG, "error when selecting for write"); - return -1; + status = -1; + goto out_cleanup; } if (BIO_flush(transport->frontBio) < 1) { WLog_ERR(TAG, "error when flushing outputBuffer"); - return -1; + status = -1; + goto out_cleanup; } } } @@ -628,6 +631,7 @@ int transport_write(rdpTransport* transport, wStream* s) Stream_Seek(s, status); } +out_cleanup: if (status < 0) { /* A write error indicates that the peer has dropped the connection */