The `gtk_text_buffer_get_text` docs¹ note:
Return value
…
The caller of the method takes ownership of the data, and is responsible for
freeing it.
¹ https://docs.gtk.org/gtk4/method.TextBuffer.get_text.html
#include <assert.h>
#include <ctype.h>
#include <glib.h>
+#include <stdlib.h>
#include "frmobjectui.h"
void mAttributesSlot(GtkWidget * widget, gpointer user_data)
gtk_text_buffer_get_end_iter(gtkbuf, &endit);
bf2 = gtk_text_buffer_get_text(gtkbuf, &startit, &endit, 0);
fprintf(output_file, "%s", bf2);
+ free(bf2);
fclose(output_file);
}