about summary refs log tree commit diff stats
path: root/src/HTML.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/HTML.c')
-rw-r--r--src/HTML.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/HTML.c b/src/HTML.c
index 083b4cc0..a0124668 100644
--- a/src/HTML.c
+++ b/src/HTML.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTML.c,v 1.195 2021/07/23 20:23:54 tom Exp $
+ * $LynxId: HTML.c,v 1.196 2021/10/24 19:10:57 tom Exp $
  *
  *		Structured stream to Rich hypertext converter
  *		============================================
@@ -6753,7 +6753,8 @@ static int HTML_end_element(HTStructured * me, int element_number,
 		*cp = '\0';
 		StrAllocCopy(temp, data);
 		*cp = '\n';
-		data = (cp + 1);
+		data = NULL;	/* HTML_put_characters may overwrite this */
+		StrAllocCopy(data, cp + 1);
 	    } else {
 		if (*data != '\0') {
 		    StrAllocCopy(temp, data);
@@ -6827,6 +6828,9 @@ static int HTML_end_element(HTStructured * me, int element_number,
 		    FREE(temp);
 		}
 	    }
+	    if (data != empty) {
+		FREE(data);
+	    }
 	    FREE(temp);
 	    cp = NULL;
 	    me->UsePlainSpace = FALSE;