]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cookie: simplify strstore(), remove outdated comment
authorDaniel Stenberg <daniel@haxx.se>
Sat, 9 May 2026 13:27:11 +0000 (15:27 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 9 May 2026 22:31:25 +0000 (00:31 +0200)
Closes #21541

lib/cookie.c

index 0f822ea7cf20c9448b593f8a26da62031a6de974..57dccf4ce9fb71cd1af340bd80954cfd4e51b723 100644 (file)
@@ -250,19 +250,11 @@ static char *sanitize_cookie_path(const char *cookie_path, size_t len)
 /*
  * strstore
  *
- * A thin wrapper around strdup which ensures that any memory allocated at
- * *str will be freed before the string allocated by strdup is stored there.
- * The intended usecase is repeated assignments to the same variable during
- * parsing in a last-wins scenario. The caller is responsible for checking
- * for OOM errors.
+ * A thin wrapper around curlx_memdup0().
  */
 static CURLcode strstore(char **str, const char *newstr, size_t len)
 {
   DEBUGASSERT(str);
-  if(!len) {
-    len++;
-    newstr = "";
-  }
   *str = curlx_memdup0(newstr, len);
   if(!*str)
     return CURLE_OUT_OF_MEMORY;