about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--CHANGES4
-rw-r--r--WWW/Library/Implementation/HTAccess.c17
-rw-r--r--WWW/Library/Implementation/HTTCP.c7
-rw-r--r--WWW/Library/Implementation/HTTP.c3
-rw-r--r--WWW/Library/Implementation/LYLeaks.h10
-rw-r--r--src/LYLeaks.c18
6 files changed, 47 insertions, 12 deletions
diff --git a/CHANGES b/CHANGES
index 698e903c..e4e81719 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,9 +1,9 @@
--- $LynxId: CHANGES,v 1.969 2018/03/28 22:33:40 tom Exp $
+-- $LynxId: CHANGES,v 1.970 2018/03/29 23:05:53 tom Exp $
 ===============================================================================
 Changes since Lynx 2.8 release
 ===============================================================================
 
-2018-03-28 (2.8.9dev.18)
+2018-03-29 (2.8.9dev.18)
 * fix a few more memory leaks -TD
 * put Lynx.leaks file in home directory like Lynx.trace (report by GV) -TD
 * fix a memory leak in HTFTP.c -GV
diff --git a/WWW/Library/Implementation/HTAccess.c b/WWW/Library/Implementation/HTAccess.c
index 4c2c1be5..0c731d1b 100644
--- a/WWW/Library/Implementation/HTAccess.c
+++ b/WWW/Library/Implementation/HTAccess.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTAccess.c,v 1.80 2016/11/24 15:29:50 tom Exp $
+ * $LynxId: HTAccess.c,v 1.81 2018/03/29 21:41:37 tom Exp $
  *
  *		Access Manager					HTAccess.c
  *		==============
@@ -1118,10 +1118,17 @@ static BOOL HTLoadDocument(const char *full_address,	/* may include #fragment */
  */
 BOOL HTLoadAbsolute(const DocAddress *docaddr)
 {
-    return HTLoadDocument(docaddr->address,
-			  HTAnchor_findAddress(docaddr),
-			  (HTOutputFormat ? HTOutputFormat : WWW_PRESENT),
-			  HTOutputStream);
+    BOOL result;
+    HTParentAnchor *anchor = HTAnchor_findAddress(docaddr);
+
+    result = HTLoadDocument(docaddr->address,
+			    anchor,
+			    (HTOutputFormat ? HTOutputFormat : WWW_PRESENT),
+			    HTOutputStream);
+    if (!result) {
+	HTAnchor_delete(anchor->parent);
+    }
+    return result;
 }
 
 #ifdef NOT_USED_CODE
diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c
index ebcfcaef..ce014ce9 100644
--- a/WWW/Library/Implementation/HTTCP.c
+++ b/WWW/Library/Implementation/HTTCP.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTTCP.c,v 1.143 2018/03/28 22:29:45 tom Exp $
+ * $LynxId: HTTCP.c,v 1.144 2018/03/30 00:13:21 tom Exp $
  *
  *			Generic Communication Code		HTTCP.c
  *			==========================
@@ -32,7 +32,9 @@
 #ifdef NSL_FORK
 #include <signal.h>
 #include <www_wait.h>
-#define FREE_NSL_FORK(p) FREE(p)
+#define FREE_NSL_FORK(p) { FREE(p); }
+#elif defined(_WINDOWS_NSL)
+#define FREE_NSL_FORK(p) if ((p) == gbl_phost) { FREE(p); }
 #else
 #define FREE_NSL_FORK(p)	/* nothing */
 #endif /* NSL_FORK */
@@ -1393,6 +1395,7 @@ static int HTParseInet(SockA * soc_in, const char *str)
 	if (!gbl_phost)
 	    goto failed;
 	MemCpy((void *) &soc_in->sin_addr, gbl_phost->h_addr_list[0], gbl_phost->h_length);
+	FREE(gbl_phost);
 #else /* !_WINDOWS_NSL */
 	{
 	    LYNX_HOSTENT *phost;
diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c
index f7e19018..e2467d06 100644
--- a/WWW/Library/Implementation/HTTP.c
+++ b/WWW/Library/Implementation/HTTP.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTTP.c,v 1.172 2018/03/21 21:25:11 tom Exp $
+ * $LynxId: HTTP.c,v 1.173 2018/03/30 00:56:26 tom Exp $
  *
  * HyperText Tranfer Protocol	- Client implementation		HTTP.c
  * ==========================
@@ -1280,6 +1280,7 @@ static int HTLoadHTTP(const char *arg,
 		   SSL_get_cipher(handle));
 	_HTProgress(msg);
 	FREE(msg);
+	FREE(ssl_all_cns);
     }
 #endif /* USE_SSL */
 
diff --git a/WWW/Library/Implementation/LYLeaks.h b/WWW/Library/Implementation/LYLeaks.h
index 8f616815..e75fd6da 100644
--- a/WWW/Library/Implementation/LYLeaks.h
+++ b/WWW/Library/Implementation/LYLeaks.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYLeaks.h,v 1.15 2018/03/28 09:28:18 tom Exp $
+ * $LynxId: LYLeaks.h,v 1.17 2018/03/30 00:35:10 tom Exp $
  */
 #ifndef __LYLEAKS_H
 /*
@@ -155,6 +155,11 @@ extern "C" {
 #endif				/* free */
 #define free(vp_alloced) LYLeakFree(vp_alloced, __FILE__, __LINE__)
 
+#ifdef strdup
+#undef strdup
+#endif				/* free */
+#define strdup(vp_alloced) LYLeakStrdup(vp_alloced, __FILE__, __LINE__)
+
 /*
  * Added the following two defines to track Lynx's frequent use of those
  * macros.  - KW 1997-10-12
@@ -249,6 +254,9 @@ extern "C" {
     extern void LYLeakFree(void *vp_alloced,
 			   const char *cp_File,
 			   const short ssi_Line);
+    extern char *LYLeakStrdup(const char *src,
+			      const char *cp_File,
+			      const short ssi_Line);
     extern char *LYLeakSACopy(char **dest,
 			      const char *src,
 			      const char *cp_File,
diff --git a/src/LYLeaks.c b/src/LYLeaks.c
index 52b86b91..2f2de289 100644
--- a/src/LYLeaks.c
+++ b/src/LYLeaks.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYLeaks.c,v 1.39 2018/03/28 09:28:32 tom Exp $
+ * $LynxId: LYLeaks.c,v 1.41 2018/03/30 00:27:58 tom Exp $
  *
  *	Copyright (c) 1994, University of Kansas, All Rights Reserved
  *	(this file was rewritten twice - 1998/1999 and 2003/2004)
@@ -742,6 +742,22 @@ void LYLeakFree(void *vp_Alloced,
 }
 
 /*
+ * Check for leaked strdup() results -TD
+ */
+char *LYLeakStrdup(const char *source,
+		   const char *cp_File,
+		   const short ssi_Line)
+{
+    size_t length = strlen(source) + 1;
+    char *target = (char *) LYLeakMalloc(length, cp_File, ssi_Line);
+
+    if (target != 0) {
+	memcpy(target, source, length);
+    }
+    return target;
+}
+
+/*
  *  Allocates a new copy of a string, and returns it.
  *  Tracks allocations by using other LYLeakFoo functions.
  *  Equivalent to HTSACopy in HTString.c - KW