degesch: reclaim more memory with Readline

This commit is contained in:
Přemysl Eric Janouch 2015-06-28 23:00:46 +02:00
parent b5d472f0df
commit fdff5f8c72
1 changed files with 9 additions and 1 deletions

View File

@ -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);