[libgepub/wip/cosimoc/api-rework: 7/13] widget: plug a memory leak



commit b4b1f12acdfcddb3e64089f142f150039a52a2e8
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sat Jun 18 12:32:39 2016 -0700

    widget: plug a memory leak

 libgepub/gepub-widget.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/libgepub/gepub-widget.c b/libgepub/gepub-widget.c
index 02292d7..bba8a62 100644
--- a/libgepub/gepub-widget.c
+++ b/libgepub/gepub-widget.c
@@ -211,14 +211,18 @@ gepub_widget_reload (GepubWidget *widget)
 {
     gsize bufsize = 0;
     guchar *buffer = NULL;
+    GBytes *current;
 
     if (!widget->doc)
       return;
 
     buffer = gepub_doc_get_current_with_epub_uris (widget->doc, &bufsize);
+    current = g_bytes_new_take (buffer, bufsize);
 
     webkit_web_view_load_bytes (WEBKIT_WEB_VIEW (widget),
-                                g_bytes_new_take (buffer, bufsize),
+                                current,
                                 gepub_doc_get_current_mime (widget->doc),
                                 "UTF-8", NULL);
+
+    g_bytes_unref (current);
 }


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