curl_path: add curlx_dyn_free() on an error path

Follow-up to 976333dd40

Closes #19183
This commit is contained in:
x2018 2025-10-22 13:24:55 +08:00 committed by Daniel Stenberg
parent 7295546447
commit 68e63a7997
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -167,8 +167,10 @@ CURLcode Curl_get_pathname(const char **cpp, char **path, const char *homedir)
/* Read to end of filename - either to whitespace or terminator */
rc = curlx_str_word(&cp, &word, MAX_PATHLENGTH);
if(rc) {
if(rc == STRE_BIG)
if(rc == STRE_BIG) {
curlx_dyn_free(&out);
return CURLE_TOO_LARGE;
}
else if(!content)
/* no path, no word, this is incorrect */
goto fail;