about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--CHANGES3
-rw-r--r--WWW/Library/Implementation/HTGopher.c3
-rwxr-xr-xsamples/lynxdump1
-rw-r--r--src/LYBookmark.c4
-rw-r--r--src/LYDownload.c3
-rw-r--r--src/LYLeaks.c26
6 files changed, 15 insertions, 25 deletions
diff --git a/CHANGES b/CHANGES
index 7f5df377..2de1caa9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,9 +1,10 @@
--- $LynxId: CHANGES,v 1.995 2018/12/27 22:39:43 tom Exp $
+-- $LynxId: CHANGES,v 1.996 2018/12/27 23:59:59 tom Exp $
 ===============================================================================
 Changes since Lynx 2.8 release
 ===============================================================================
 
 2018-12-27 (2.9.0dev.1)
+* memory-leak and dead-code fixes from static analysis (patch by Kamil Dudka).
 * restore whitespace in info-page omitted in 2.8.9dev.17, useful for screen
   readers (report by Dan Dunfee) -Chuck Martin
 * improve error-checks in parsdate.y (prompted by patch by TH) -TD
diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c
index a9ad41e4..854694e5 100644
--- a/WWW/Library/Implementation/HTGopher.c
+++ b/WWW/Library/Implementation/HTGopher.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTGopher.c,v 1.68 2018/05/15 21:58:15 tom Exp $
+ * $LynxId: HTGopher.c,v 1.69 2018/12/27 23:48:37 Kamil.Dudka Exp $
  *
  *			GOPHER ACCESS				HTGopher.c
  *			=============
@@ -1651,6 +1651,7 @@ static int HTLoadCSO(const char *arg,
 	(*Target->isa->put_block) (Target, buf, (int) strlen(buf));
 	(*Target->isa->_free) (Target);
 	free_CSOfields();
+	BStrFree(command);
 	return HT_LOADED;
     }
     /*
diff --git a/samples/lynxdump b/samples/lynxdump
index f79be2fa..a0e9ae23 100755
--- a/samples/lynxdump
+++ b/samples/lynxdump
@@ -12,4 +12,5 @@ if test $HOME/.lynxrc ; then
 fi
 echo 'keypad_mode=NUMBERS_AS_ARROWS' >> $MYTMP/.lynxrc
 HOME=$MYTMP; export HOME
+umask $oldmask
 lynx -justify -dump -force_html -with_backspaces -nolist $*
diff --git a/src/LYBookmark.c b/src/LYBookmark.c
index c3116ef6..ac646914 100644
--- a/src/LYBookmark.c
+++ b/src/LYBookmark.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYBookmark.c,v 1.78 2018/03/18 19:27:30 tom Exp $
+ * $LynxId: LYBookmark.c,v 1.79 2018/12/27 23:48:37 Kamil.Dudka Exp $
  */
 #include <HTUtils.h>
 #include <HTAlert.h>
@@ -303,6 +303,7 @@ void save_bookmark_link(const char *address,
 	    LYMBM_statusline(CANCELLED);
 	    LYSleepMsg();
 	    FREE(bookmark_URL);
+	    BStrFree(tmp_data);
 	    return;
 	}
     } while (!havevisible(string_data->str));
@@ -347,6 +348,7 @@ void save_bookmark_link(const char *address,
 	LYSleepAlert();
 	FREE(Title);
 	FREE(bookmark_URL);
+	BStrFree(tmp_data);
 	return;
     }
 
diff --git a/src/LYDownload.c b/src/LYDownload.c
index cf1ea980..fcaba027 100644
--- a/src/LYDownload.c
+++ b/src/LYDownload.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYDownload.c,v 1.70 2018/05/11 22:57:30 tom Exp $ */
+/* $LynxId: LYDownload.c,v 1.71 2018/12/27 23:48:37 Kamil.Dudka Exp $ */
 #include <HTUtils.h>
 #include <HTParse.h>
 #include <HTList.h>
@@ -456,6 +456,7 @@ void LYDownload(char *line)
   cleanup:
     FREE(Line);
     BStrFree(buffer);
+    BStrFree(command);
     return;
 }
 
diff --git a/src/LYLeaks.c b/src/LYLeaks.c
index 3e212760..d082a77b 100644
--- a/src/LYLeaks.c
+++ b/src/LYLeaks.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYLeaks.c,v 1.42 2018/12/27 10:33:52 tom Exp $
+ * $LynxId: LYLeaks.c,v 1.43 2018/12/27 23:48:37 Kamil.Dudka Exp $
  *
  *	Copyright (c) 1994, University of Kansas, All Rights Reserved
  *	(this file was rewritten twice - 1998/1999 and 2003/2004)
@@ -1090,26 +1090,10 @@ static char *LYLeakSAVsprintf(char **dest,
 		mark_realloced(ALp_old, *dest, strlen(*dest) + 1, cp_File, ssi_Line);
 		return (*dest);
 	    }
-	    if (vp_realloced == vp_oldAlloced) {
-		ALp_new->SL_memory.cp_FileName = old_cp_File;
-		ALp_new->SL_memory.ssi_LineNumber = old_ssi_Line;
-		ALp_new->SL_realloc.cp_FileName = cp_File;
-		ALp_new->SL_realloc.ssi_LineNumber = ssi_Line;
-		return (*dest);
-	    }
-	    /* Look up again, list may have changed! - kw */
-	    ALp_old = FindInList(vp_oldAlloced);
-	    if (ALp_old == NULL) {
-		ALp_new->SL_memory.cp_FileName = old_cp_File;
-		ALp_new->SL_memory.ssi_LineNumber = old_ssi_Line;
-		ALp_new->SL_realloc.cp_FileName = cp_File;
-		ALp_new->SL_realloc.ssi_LineNumber = ssi_Line;
-	    } else {
-		ALp_new->SL_memory.cp_FileName = old_cp_File;
-		ALp_new->SL_memory.ssi_LineNumber = old_ssi_Line;
-		ALp_new->SL_realloc.cp_FileName = cp_File;
-		ALp_new->SL_realloc.ssi_LineNumber = ssi_Line;
-	    }
+	    ALp_new->SL_memory.cp_FileName = old_cp_File;
+	    ALp_new->SL_memory.ssi_LineNumber = old_ssi_Line;
+	    ALp_new->SL_realloc.cp_FileName = cp_File;
+	    ALp_new->SL_realloc.ssi_LineNumber = ssi_Line;
 	}
 	return (*dest);
     }