Fix memory leak
[claws.git] / src / plugins / litehtml_viewer / http.cpp
index e6547ebffd9b95ecadb7e1823fea1de91d4ab596..68af73601c96dd7a3a4543b841eb89a0e8a105e0 100644 (file)
@@ -80,8 +80,10 @@ 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 {
-           stream = g_memory_input_stream_new_from_data(g_memdup(data.memory, data.size), data.size, http::destroy_giostream);
+           void *bytes = g_memdup(data.memory, data.size);
            g_free(data.memory);
+           stream = g_memory_input_stream_new_from_data(bytes, data.size, http::destroy_giostream);
+           g_free(bytes);
        }
     }