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; }