From 8392a0cf612eaf045addc0b5d8da6d287be33907 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Sat, 30 Sep 2017 14:10:12 +0200
Subject: cookie: fix memory leak if path was set twice in header

... this will let the second occurance override the first.

Added test 1161 to verify.

Reported-by: Max Dymond
Fixes #1932
Closes #1933
---
 lib/cookie.c | 1 +
 1 file changed, 1 insertion(+)

(limited to 'lib')

diff --git a/lib/cookie.c b/lib/cookie.c
index 1d7defd84..271f6d49d 100644
--- a/lib/cookie.c
+++ b/lib/cookie.c
@@ -499,6 +499,7 @@ Curl_cookie_add(struct Curl_easy *data,
             badcookie = TRUE; /* out of memory bad */
             break;
           }
+          free(co->spath); /* if this is set again */
           co->spath = sanitize_cookie_path(co->path);
           if(!co->spath) {
             badcookie = TRUE; /* out of memory bad */
-- 
cgit v1.2.3