Fixed FD leak in fssrc.
authorFredrik Tolf <fredrik@seatribe.se>
Tue, 14 Jun 2011 19:25:27 +0000 (21:25 +0200)
committerFredrik Tolf <fredrik@seatribe.se>
Tue, 14 Jun 2011 19:25:27 +0000 (21:25 +0200)
fssrc.c

diff --git a/fssrc.c b/fssrc.c
index 8a34ddb..c69da66 100644 (file)
--- a/fssrc.c
+++ b/fssrc.c
@@ -49,12 +49,14 @@ static struct fileinfo fsserve(struct source *src, char *nm)
            flog(LOG_ERR, "fssrc: %s: %s", p, strerror(errno));
            free(p);
            buffree(rb);
+           close(fd);
            return((struct fileinfo){});
        }
        if(ret == 0)
            break;
        rb.d += ret;
     }
+    close(fd);
     return((struct fileinfo){.mtime = sb.st_mtime, .sz = rb.d, .data = rb.b, .ctype = "image/png"});
 }