diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index 5db7104334..09f6a46d61 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -435,6 +435,7 @@ static int local_opendir(FsContext *ctx, stream = fdopendir(dirfd); if (!stream) { + close(dirfd); return -1; } fs->dir.stream = stream;