diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c index 63bcbd7402..ae21906122 100644 --- a/src/nwfilter/nwfilter_ebiptables_driver.c +++ b/src/nwfilter/nwfilter_ebiptables_driver.c @@ -2245,7 +2245,8 @@ ebiptablesWriteToTempFile(const char *string) { err_exit: VIR_FREE(header); - close(fd); + if (fd >= 0) + close(fd); unlink(filename); return NULL; }