summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-11-09 13:02:43 -0500
committerMatthias Clasen <mclasen@redhat.com>2020-11-09 18:48:10 -0500
commitb622745501bcc65b882e0db2c0367317ea7f3b26 (patch)
treefaf625e3eacea7eb98a545394322a5a2f854b46c
parent5379a4bf347cdaa2f8e9eba12fceb3c7419c882d (diff)
downloadgtk+-b622745501bcc65b882e0db2c0367317ea7f3b26.tar.gz
gtk-demo: Plug a memory leak
-rw-r--r--demos/gtk-demo/fontify.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/demos/gtk-demo/fontify.c b/demos/gtk-demo/fontify.c
index f66c04de45..62bc34b803 100644
--- a/demos/gtk-demo/fontify.c
+++ b/demos/gtk-demo/fontify.c
@@ -501,7 +501,7 @@ fontify (const char *format,
char *theme;
gboolean prefer_dark;
const char *style_arg;
- const char *text;
+ char *text;
GtkTextIter start, end;
GBytes *bytes;
GError *error = NULL;
@@ -553,7 +553,7 @@ fontify (const char *format,
gtk_text_buffer_get_bounds (source_buffer, &start, &end);
text = gtk_text_buffer_get_text (source_buffer, &start, &end, TRUE);
- bytes = g_bytes_new_static (text, strlen (text));
+ bytes = g_bytes_new_take (text, strlen (text));
#ifdef HAVE_GIO_UNIX
/* Work around https://gitlab.gnome.org/GNOME/glib/-/issues/2182 */
@@ -570,4 +570,5 @@ fontify (const char *format,
NULL,
fontify_finish,
g_object_ref (source_buffer));
+ g_bytes_unref (bytes);
}