]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
imagecache: coverity - fix wrong unlink() call
authorJaroslav Kysela <perex@perex.cz>
Fri, 3 Oct 2014 12:42:26 +0000 (14:42 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 3 Oct 2014 12:42:26 +0000 (14:42 +0200)
src/imagecache.c

index 3f31dabab7aa97bf860cba9fcce66206df1c9d3d..f62016054ff250ded16305538434d7c613f75767 100644 (file)
@@ -139,7 +139,7 @@ imagecache_image_fetch ( imagecache_image_t *img )
   int res = 1, r;
   FILE *fp = NULL;
   url_t url;
-  char tmp[256], path[256];
+  char tmp[256] = "", path[256];
   tvhpoll_event_t ev;
   tvhpoll_t *efd = NULL;
   http_client_t *hc;
@@ -215,7 +215,8 @@ error:
   time(&img->updated); // even if failed (possibly request sooner?)
   if (res) {
     img->failed = 1;
-    unlink(tmp);
+    if (tmp[0])
+      unlink(tmp);
     tvhlog(LOG_WARNING, "imagecache", "failed to download %s", img->url);
   } else {
     img->failed = 0;