From 39f684b39a11ec619f2b26c3fede7eafd91c284c Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Mon, 14 May 2018 16:37:56 -0400 Subject: [PATCH] Do not call close() with a negative value Check the value of *pidfilefd before calling close(*pidfilefd). Signed-off-by: Stefan Berger --- src/swtpm/common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/swtpm/common.c b/src/swtpm/common.c index 1effacc..e326833 100644 --- a/src/swtpm/common.c +++ b/src/swtpm/common.c @@ -473,7 +473,8 @@ parse_pid_options(char *options, char **pidfile, int *pidfilefd) error: option_values_free(ovs); - close(*pidfilefd); + if (*pidfilefd >= 0) + close(*pidfilefd); return -1; }