aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-06-28 23:00:46 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-06-28 23:00:46 +0200
commitfdff5f8c72552e8f677636e4c119616a684b2344 (patch)
tree52f55f151b3092a6a63d1060595370e3669b6540
parentb5d472f0df391c633f16774fd178b3803df764f6 (diff)
downloadxK-fdff5f8c72552e8f677636e4c119616a684b2344.tar.gz
xK-fdff5f8c72552e8f677636e4c119616a684b2344.tar.xz
xK-fdff5f8c72552e8f677636e4c119616a684b2344.zip
degesch: reclaim more memory with Readline
-rw-r--r--degesch.c10
1 files changed, 9 insertions, 1 deletions
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);