[master] e94de5d Close the fd on failure.

Poul-Henning Kamp phk at varnish-cache.org
Tue Oct 1 17:02:39 CEST 2013


commit e94de5d976b5d397de7324b41fcff64260839c8f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Oct 1 15:02:14 2013 +0000

    Close the fd on failure.
    
    Spotted by: Coverity

diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c
index d168ec3..05adb14 100644
--- a/bin/varnishtest/vtc_main.c
+++ b/bin/varnishtest/vtc_main.c
@@ -127,6 +127,7 @@ read_file(const char *fn)
 	s = read(fd, buf, sz - 1);
 	if (s <= 0) {
 		free(buf);
+		(void)close(fd);
 		return (NULL);
 	}
 	AZ(close (fd));



More information about the varnish-commit mailing list