commit 53ea6f806cd72e597d86bcfa24c9c813e1034e79
parent e62c01edd0c6bfc6c9c2e7b9645497603b8f8e83
Author: Ricardo Mones <ricardo@mones.org>
Date: Tue, 18 Oct 2016 00:13:24 +0200
Fix resource leak and missing return
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/plugins/libravatar/libravatar_image.c b/src/plugins/libravatar/libravatar_image.c
@@ -81,6 +81,7 @@ static GdkPixbuf *pixbuf_from_url(const gchar *url, const gchar *md5, const gcha
curl = curl_easy_init();
if (curl == NULL) {
g_warning("could not initialize curl to get image from URL");
+ fclose(file);
return NULL;
}
@@ -141,7 +142,7 @@ GdkPixbuf *libravatar_image_fetch(AvatarImageFetch *ctx)
pthread_t pt;
#endif
- g_return_if_fail(ctx != NULL);
+ g_return_val_if_fail(ctx != NULL, NULL);
#ifdef USE_PTHREAD
if (pthread_create(&pt, PTHREAD_CREATE_JOINABLE, get_image_thread, (void *)ctx) != 0) {