]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl_path: add curlx_dyn_free() on an error path
authorx2018 <xkernel.wang@foxmail.com>
Wed, 22 Oct 2025 05:24:55 +0000 (13:24 +0800)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 22 Oct 2025 07:37:54 +0000 (09:37 +0200)
Follow-up to 976333dd4052855c22369e89

Closes #19183

lib/vssh/curl_path.c

index 44ea3d07a564d94de6c06bb1ba02b1797bc3ffdc..a6d572520fac14dc75882715aaf717b787ee9057 100644 (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;