[CRIU] [PATCH 2/4] image: don't leak a file descriptor
Andrey Vagin
avagin at openvz.org
Fri Dec 20 13:13:31 PST 2013
CID 1141015 (#1 of 1): Resource leak (RESOURCE_LEAK)
8. leaked_handle: Handle variable fd going out of scope leaks the handle.
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
image.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/image.c b/image.c
index f6bb3f7..79cc4ea 100644
--- a/image.c
+++ b/image.c
@@ -240,6 +240,8 @@ int open_image_dir(char *dir)
}
ret = install_service_fd(IMG_FD_OFF, fd);
+ close(fd);
+ fd = ret;
if (opts.img_parent) {
int pfd;
@@ -261,8 +263,6 @@ int open_image_dir(char *dir)
close(pfd);
}
- close(fd);
-
return ret;
err:
--
1.8.3.1
More information about the CRIU
mailing list