Fix possible memory leak
authorMichael Rasmussen <mir@datanom.net>
Tue, 29 Jan 2019 23:29:12 +0000 (00:29 +0100)
committerAndrej Kacian <ticho@claws-mail.org>
Tue, 12 Feb 2019 18:38:10 +0000 (19:38 +0100)
Signed-off-by: Michael Rasmussen <mir@datanom.net>

src/plugins/litehtml_viewer/http.cpp

index ff9bcad..21e53fc 100644 (file)
@@ -70,11 +70,11 @@ GInputStream *http::load_url(const gchar *url, GError **error)
        } else {
                struct Data data;
 
-               data.memory = g_memory_input_stream_new();
-               data.size = 0;
-
                if (!curl) return NULL;
 
+                data.memory = g_memory_input_stream_new();
+                data.size = 0;
+
                curl_easy_setopt(curl, CURLOPT_URL, url);
                curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&data);
                res = curl_easy_perform(curl);