summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buffer.c7
-rw-r--r--valgrind_suppresions.txt7
2 files changed, 13 insertions, 1 deletions
diff --git a/buffer.c b/buffer.c
index 8cf2760..308c12d 100644
--- a/buffer.c
+++ b/buffer.c
@@ -377,6 +377,7 @@ static void buffer_remove_last_edit_if_empty(TextBuffer *buffer) {
if (buffer->store_undo_events) {
BufferEdit *last_edit = arr_lastp(buffer->undo_history);
if (last_edit && !buffer_edit_does_anything(buffer, last_edit)) {
+ buffer_edit_free(last_edit);
arr_remove_last(buffer->undo_history);
}
}
@@ -435,7 +436,6 @@ static void buffer_line_free(Line *line) {
// Does not free the pointer `buffer` (buffer might not have even been allocated with malloc)
void buffer_free(TextBuffer *buffer) {
-
Line *lines = buffer->lines;
u32 nlines = buffer->nlines;
for (u32 i = 0; i < nlines; ++i) {
@@ -443,6 +443,11 @@ void buffer_free(TextBuffer *buffer) {
}
free(lines);
+ arr_foreach_ptr(buffer->undo_history, BufferEdit, edit)
+ buffer_edit_free(edit);
+ arr_foreach_ptr(buffer->redo_history, BufferEdit, edit)
+ buffer_edit_free(edit);
+
arr_free(buffer->undo_history);
arr_free(buffer->redo_history);
diff --git a/valgrind_suppresions.txt b/valgrind_suppresions.txt
index 3a6bc8d..45424fb 100644
--- a/valgrind_suppresions.txt
+++ b/valgrind_suppresions.txt
@@ -1,5 +1,12 @@
{
<insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ fun:_dbus_strdup
+ ...
+}
+{
+ <insert_a_suppression_name_here>
Memcheck:Addr8
obj:/usr/lib/x86_64-linux-gnu/libdrm.so.2.4.0
obj:/usr/lib/x86_64-linux-gnu/libdrm.so.2.4.0