summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--src/imlib.c9
2 files changed, 10 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index b29c07e..cd4a8a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
* Replace autoconf by config.mk
* patch by decklin: Use z key to randomly jump in the filelist
* patch by muennich: Correctly set [Paused] window title in slideshow mode
+ * patch by dylan: Remove temporary files if url opening fails
* Fix problems with unexpectedly empty filelists
Tue Mar 16 07:56:36 CET 2010 Daniel Friesel <derf@chaosdorf.de>
diff --git a/src/imlib.c b/src/imlib.c
index a789e1b..6c40245 100644
--- a/src/imlib.c
+++ b/src/imlib.c
@@ -310,6 +310,8 @@ char *feh_http_load_image(char *url)
hostname = feh_strip_hostname(newurl);
if (!hostname) {
weprintf("couldn't work out hostname from %s:", newurl);
+ fclose(fp);
+ unlink(tmpname);
free(tmpname);
free(newurl);
D_RETURN(4, NULL);
@@ -319,6 +321,8 @@ char *feh_http_load_image(char *url)
if (!(hptr = feh_gethostbyname(hostname))) {
weprintf("error resolving host %s:", hostname);
+ fclose(fp);
+ unlink(tmpname);
free(hostname);
free(tmpname);
free(newurl);
@@ -334,6 +338,8 @@ char *feh_http_load_image(char *url)
if ((sockno = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
weprintf("error opening socket:");
+ fclose(fp);
+ unlink(tmpname);
free(tmpname);
free(hostname);
free(newurl);
@@ -341,6 +347,8 @@ char *feh_http_load_image(char *url)
}
if (connect(sockno, (struct sockaddr *) &addr, sizeof(addr)) == -1) {
weprintf("error connecting socket:");
+ fclose(fp);
+ unlink(tmpname);
free(tmpname);
free(hostname);
free(newurl);
@@ -486,6 +494,7 @@ char *feh_http_load_image(char *url)
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
weprintf("url: wget failed to load URL %s\n", url);
+ unlink(opt.wget_timestamp ? tmpname_timestamper : tmpname);
free(newurl);
free(tmpname);
D_RETURN(4, NULL);