summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.adoc1
-rw-r--r--src/gui/gui-chat.c39
2 files changed, 23 insertions, 17 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index a40ab9f0d..a0fcea6de 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -26,6 +26,7 @@ New features::
Bug fixes::
+ * core: fix memory leak when removing a line on a buffer with free content
* core: remove obsolete option weechat.plugin.debug (issue #1744)
* core: fix search of commands with UTF-8 chars in name when option weechat.look.command_incomplete is on (issue #1739)
* core: fix display of hotlist in buflist after changing value of option weechat.look.hotlist_sort (issue #1733)
diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c
index cf42e7cb9..7620a6344 100644
--- a/src/gui/gui-chat.c
+++ b/src/gui/gui-chat.c
@@ -1092,28 +1092,33 @@ gui_chat_printf_y (struct t_gui_buffer *buffer, int y, const char *message, ...)
free (new_line);
}
}
- else if (gui_init_ok)
+ else
{
- /* delete line */
- last_y = (new_line->data->buffer->own_lines->last_line) ?
- new_line->data->buffer->own_lines->last_line->data->y : 0;
- if (y <= last_y)
+ if (gui_init_ok)
{
- for (ptr_line = new_line->data->buffer->own_lines->first_line;
- ptr_line; ptr_line = ptr_line->next_line)
- {
- if (ptr_line->data->y >= y)
- break;
- }
- if (ptr_line && (ptr_line->data->y == y))
+ /* delete line */
+ last_y = (new_line->data->buffer->own_lines->last_line) ?
+ new_line->data->buffer->own_lines->last_line->data->y : 0;
+ if (y <= last_y)
{
- if (ptr_line->next_line)
- gui_line_clear (ptr_line);
- else
- gui_line_free (new_line->data->buffer, ptr_line);
- gui_buffer_ask_chat_refresh (new_line->data->buffer, 2);
+ for (ptr_line = new_line->data->buffer->own_lines->first_line;
+ ptr_line; ptr_line = ptr_line->next_line)
+ {
+ if (ptr_line->data->y >= y)
+ break;
+ }
+ if (ptr_line && (ptr_line->data->y == y))
+ {
+ if (ptr_line->next_line)
+ gui_line_clear (ptr_line);
+ else
+ gui_line_free (new_line->data->buffer, ptr_line);
+ gui_buffer_ask_chat_refresh (new_line->data->buffer, 2);
+ }
}
}
+ gui_line_free_data (new_line);
+ free (new_line);
}
end: