mirror of
https://github.com/curl/curl.git
synced 2026-08-02 18:30:27 +03:00
ngtcp2: fix coverity warning about result handling
Coverity correctly complained that a `result` assignement from `r2` was overwritten directly afterwards. Fix the issue by using `r2` only where necessary and add a comment about why we have `r2` in the first place.
This commit is contained in:
parent
73840836a5
commit
2c9cc7fa5f
1 changed files with 15 additions and 16 deletions
|
|
@ -1282,7 +1282,7 @@ static CURLcode cf_ngtcp2_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
|
|||
struct h3_stream_ctx *stream = H3_STREAM_CTX(ctx, data);
|
||||
struct cf_call_data save;
|
||||
struct pkt_io_ctx pktx;
|
||||
CURLcode result = CURLE_OK;
|
||||
CURLcode result = CURLE_OK, r2;
|
||||
|
||||
(void)ctx;
|
||||
(void)buf;
|
||||
|
|
@ -1325,15 +1325,15 @@ static CURLcode cf_ngtcp2_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
|
|||
result = CURLE_AGAIN;
|
||||
|
||||
out:
|
||||
if(cf_progress_egress(cf, data, &pktx)) {
|
||||
result = CURLE_SEND_ERROR;
|
||||
}
|
||||
else {
|
||||
CURLcode r2 = check_and_set_expiry(cf, data, &pktx);
|
||||
if(r2)
|
||||
result = r2;
|
||||
}
|
||||
/* do not replace `result` unless we have an error here */
|
||||
r2 = cf_progress_egress(cf, data, &pktx);
|
||||
if(r2)
|
||||
result = r2;
|
||||
r2 = check_and_set_expiry(cf, data, &pktx);
|
||||
if(r2)
|
||||
result = r2;
|
||||
CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] cf_recv(blen=%zu) -> %dm, %zu",
|
||||
|
||||
stream ? stream->id : -1, blen, result, *pnread);
|
||||
CF_DATA_RESTORE(cf, save);
|
||||
return result;
|
||||
|
|
@ -1595,10 +1595,9 @@ static CURLcode cf_ngtcp2_send(struct Curl_cfilter *cf, struct Curl_easy *data,
|
|||
return ctx->tls_vrfy_result;
|
||||
|
||||
(void)eos; /* use for stream EOF and block handling */
|
||||
r2 = cf_progress_ingress(cf, data, &pktx);
|
||||
if(r2) {
|
||||
result = r2;
|
||||
}
|
||||
result = cf_progress_ingress(cf, data, &pktx);
|
||||
if(result)
|
||||
goto out;
|
||||
|
||||
if(!stream || stream->id < 0) {
|
||||
if(ctx->shutdown_started) {
|
||||
|
|
@ -1655,11 +1654,11 @@ static CURLcode cf_ngtcp2_send(struct Curl_cfilter *cf, struct Curl_easy *data,
|
|||
if(*pnwritten > 0 && !ctx->tls_handshake_complete && ctx->use_earlydata)
|
||||
ctx->earlydata_skip += *pnwritten;
|
||||
|
||||
r2 = cf_progress_egress(cf, data, &pktx);
|
||||
if(r2)
|
||||
result = r2;
|
||||
DEBUGASSERT(!result);
|
||||
result = cf_progress_egress(cf, data, &pktx);
|
||||
|
||||
out:
|
||||
/* do not overwrite `result` unless there is an error */
|
||||
r2 = check_and_set_expiry(cf, data, &pktx);
|
||||
if(r2)
|
||||
result = r2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue