Commit e54cc94af2217992a549a0ae0cf2d38314120297

Stefan Sperling 2020-11-11T00:34:59

plug two memory leaks in tog's draw_file()

diff --git a/tog/tog.c b/tog/tog.c
index 5c342d0..07b0a44 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -2823,6 +2823,8 @@ draw_file(struct tog_view *view, FILE *f, int first_displayed_line, int nlines,
 		if (view_needs_focus_indication(view))
 			wstandout(view->window);
 		waddwstr(view->window, wline);
+		free(wline);
+		wline = NULL;
 		if (view_needs_focus_indication(view))
 			wstandend(view->window);
 		if (width <= view->ncols - 1)
@@ -2881,6 +2883,8 @@ draw_file(struct tog_view *view, FILE *f, int first_displayed_line, int nlines,
 
 		wstandout(view->window);
 		waddwstr(view->window, wline);
+		free(wline);
+		wline = NULL;
 		wstandend(view->window);
 	}