diff --git a/src/port/exec.c b/src/port/exec.c
index 742318d0570abbccbcd4a43e80606ff1662a6838..cc044ea5f032c9f9b0b8e2d33182367f657650f7 100644
--- a/src/port/exec.c
+++ b/src/port/exec.c
@@ -357,6 +357,7 @@ pipe_read_line(char *cmd, char *line, int maxsize)
 
 	if (fgets(line, maxsize, pgver) == NULL)
 	{
+		pclose(pgver);		/* no error checking */
 		perror("fgets failure");
 		return NULL;
 	}