[gtk/leak-fixes: 3/4] gtk-demo: Don't leak the markup




commit 2d72ba21ce2c466e88b73780daac0f8ab8378a03
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Aug 7 15:19:33 2020 -0400

    gtk-demo: Don't leak the markup

 demos/gtk-demo/main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c
index 1589b3d4bc..b14e3b0909 100644
--- a/demos/gtk-demo/main.c
+++ b/demos/gtk-demo/main.c
@@ -319,13 +319,13 @@ fontify (const char    *format,
   bytes = fontify_text (format, text);
   if (bytes)
     {
-      const char *markup;
+      char *markup;
       gsize len;
 
-      markup = g_bytes_get_data (bytes, &len);
+      markup = g_bytes_unref_to_data (bytes, &len);
       gtk_text_buffer_delete (source_buffer, &start, &end);
       gtk_text_buffer_insert_markup (source_buffer, &start, markup, len);
-      g_bytes_unref (bytes);
+      g_free (markup);
     }
 
   g_free (text);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]