X-Git-Url: http://dolda2000.com/gitweb/?p=ashd.git;a=blobdiff_plain;f=src%2Fpsendfile.c;h=f5c7fdd466c2519023c6412de353f9830989bb55;hp=52ec9dc2204b6ef5ae4f86e7b18719eefc537697;hb=107712e330c1921d198dcb2c70c8369cda2d85be;hpb=a0ef58b1f5b0759e7bcd19a4d6e1eceae0b51edb diff --git a/src/psendfile.c b/src/psendfile.c index 52ec9dc..f5c7fdd 100644 --- a/src/psendfile.c +++ b/src/psendfile.c @@ -238,7 +238,7 @@ static void serve(struct muth *muth, va_list args) simpleerror2(out, 404, "Not Found", "The requested URL has no corresponding resource."); goto out; } - if(((sfile = fopen(file, "r")) < 0) || fstat(fileno(sfile), &sb)) { + if(((sfile = fopen(file, "r")) == NULL) || fstat(fileno(sfile), &sb)) { flog(LOG_ERR, "psendfile: could not stat input file %s: %s", file, strerror(errno)); simpleerror2(out, 500, "Internal Error", "The server could not access its own data."); goto out; @@ -268,7 +268,8 @@ static void serve(struct muth *muth, va_list args) out: if(sfile != NULL) fclose(sfile); - free(contype); + if(contype != NULL) + free(contype); fclose(out); freehthead(req); }