Proper fix for memory leak
authorMichael Rasmussen <mir@datanom.net>
Fri, 16 Nov 2018 16:13:05 +0000 (17:13 +0100)
committerAndrej Kacian <ticho@claws-mail.org>
Tue, 12 Feb 2019 18:38:09 +0000 (19:38 +0100)
Signed-off-by: Michael Rasmussen <mir@datanom.net>
src/plugins/litehtml_viewer/http.cpp

index 68af73601c96dd7a3a4543b841eb89a0e8a105e0..92023be85df174f178156bf44b4737cde390108a 100644 (file)
@@ -80,10 +80,9 @@ GInputStream *http::load_url(const gchar *url, GError **error)
        if (res != CURLE_OK) {
            _error = g_error_new_literal(G_FILE_ERROR, res, curl_easy_strerror(res));
        } else {
-           void *bytes = g_memdup(data.memory, data.size);
+           g_log(NULL, G_LOG_LEVEL_MESSAGE, "Image size: %d", data.size);
+           stream = g_memory_input_stream_new_from_data(g_memdup(data.memory, data.size), data.size, http::destroy_giostream);
            g_free(data.memory);
-           stream = g_memory_input_stream_new_from_data(bytes, data.size, http::destroy_giostream);
-           g_free(bytes);
        }
     }