Fix memory leak (from Daniel Stenberg via commit 4b4062aa) - pkgsrc-localpatches - leot's pkgsrc LOCALPATCHES
(HTM) hg clone https://bitbucket.org/iamleot/pkgsrc-localpatches
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) changeset 024501ed3cc79721a8f4d48050a5f3a8f56443ef
(DIR) parent 21a516e29e2f07e812d92885681f7791c512eba9
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Fri, 14 Dec 2018 17:28:29
Fix memory leak (from Daniel Stenberg via commit 4b4062aa)
Diffstat:
www/curl/patch-3370.patch | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
---
diff -r 21a516e29e2f -r 024501ed3cc7 www/curl/patch-3370.patch
--- a/www/curl/patch-3370.patch Thu Dec 13 02:05:33 2018 +0100
+++ b/www/curl/patch-3370.patch Fri Dec 14 17:28:29 2018 +0100
@@ -15,10 +15,13 @@
<https://github.com/curl/curl/pull/3370>
+Also backport commit 4b4062aaebb8c945a4b29587229a98946c9edaa3 by
+Daniel Stenberg to avoid a memory leak (whoops!).
+
diff --git a/lib/gopher.c b/lib/gopher.c
index b441a641d9..151bac1adb 100644
---- lib/gopher.c.orig
-+++ lib/gopher.c
+--- lib/gopher.c.orig 2018-11-21 23:48:11.000000000 +0100
++++ lib/gopher.c 2018-12-14 17:21:44.587706330 +0100
@@ -31,9 +31,11 @@
#include "progress.h"
#include "gopher.h"
@@ -41,7 +44,7 @@
char *sel = NULL;
char *sel_org = NULL;
ssize_t amount, k;
-@@ -86,8 +90,16 @@ static CURLcode gopher_do(struct connectdata *conn, bool *done)
+@@ -86,20 +90,30 @@ static CURLcode gopher_do(struct connectdata *conn, bool *done)
*done = TRUE; /* unconditionally */
@@ -58,8 +61,9 @@
+ if(strlen(gopherpath) <= 2) {
sel = (char *)"";
len = strlen(sel);
++ free(gopherpath);
}
-@@ -95,11 +107,12 @@ static CURLcode gopher_do(struct connectdata *conn, bool *done)
+ else {
char *newp;
/* Otherwise, drop / and the first character (i.e., item type) ... */