commit 4ed9411f4dc2801d7f983734ae4003102b8f361d
parent 3fdfe990c6976d2e5b41b27655dc3c4da5bccb94
Author: Ricardo Mones <ricardo@mones.org>
Date: Sun, 21 Jun 2020 19:41:40 +0200
Fix bug 4220 "generates files in cache without content"
Also replace "safe" call, since file should not be locked and is
going to be deleted anyway.
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/plugins/libravatar/libravatar_image.c b/src/plugins/libravatar/libravatar_image.c
@@ -83,6 +83,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");
+ unlink(filename);
claws_fclose(file);
return NULL;
}
@@ -113,7 +114,8 @@ static GdkPixbuf *pixbuf_from_url(const gchar *url, const gchar *md5, const gcha
res = curl_easy_perform(curl);
if (res != CURLE_OK) {
debug_print("curl_easy_perfom failed: %s", curl_easy_strerror(res));
- claws_safe_fclose(file);
+ unlink(filename);
+ claws_fclose(file);
} else {
filesize = ftell(file);
claws_safe_fclose(file);