http_add_connection_hd: respect previous error

Pointed out by CodeSonar

Closes #18472
This commit is contained in:
Daniel Stenberg 2025-09-04 00:46:08 +02:00
parent 5ef4451f7b
commit 31659b4a7a
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -2657,7 +2657,7 @@ static CURLcode http_add_connection_hd(struct Curl_easy *data,
if(!result && data->state.http_hd_h2_settings) {
result = curlx_dyn_addf(req, "%s%s", sep, "HTTP2-Settings");
}
if(rlen < curlx_dyn_len(req))
if(!result && (rlen < curlx_dyn_len(req)))
result = curlx_dyn_addn(req, STRCONST("\r\n"));
free(custom_val);