From fdff5f8c72552e8f677636e4c119616a684b2344 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Sun, 28 Jun 2015 23:00:46 +0200 Subject: degesch: reclaim more memory with Readline --- degesch.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/degesch.c b/degesch.c index cbb20d3..dc9427e 100644 --- a/degesch.c +++ b/degesch.c @@ -397,6 +397,9 @@ input_destroy_buffer (struct input *self, struct input_buffer *buffer) history_set_history_state (buffer->history); rl_clear_history (); + // rl_clear_history just removes history entries, + // we have to reclaim memory for their actual container ourselves + free (buffer->history->entries); free (buffer->history); buffer->history = NULL; @@ -1338,9 +1341,14 @@ app_context_free (struct app_context *self) for (size_t i = 0; i < ATTR_COUNT; i++) free (self->attrs[i]); - // FIXME: this doesn't free the history state LIST_FOR_EACH (struct buffer, iter, self->buffers) + { +#ifdef HAVE_READLINE + input_destroy_buffer (&self->input, iter->input_data); + iter->input_data = NULL; +#endif // HAVE_READLINE buffer_destroy (iter); + } str_map_free (&self->buffers_by_name); str_map_free (&self->servers); -- cgit v1.2.3-70-g09d2