diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c index 0b3ac46183..5d21164c82 100644 --- a/src/util/virnetdevtap.c +++ b/src/util/virnetdevtap.c @@ -341,7 +341,8 @@ int virNetDevTapCreateInBridgePort(const char *brname, return 0; error: - VIR_FORCE_CLOSE(*tapfd); + if (tapfd) + VIR_FORCE_CLOSE(*tapfd); return errno; }