[CRIU] [PATCH] page-xfer: add proper initialization and deletion of xfer->parent

Tikhomirov Pavel snorcht at gmail.com
Wed Feb 5 23:22:07 PST 2014


Signed-off-by: Tikhomirov Pavel <snorcht at gmail.com>
---
 page-xfer.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/page-xfer.c b/page-xfer.c
index e56acfc..2623ed1 100644
--- a/page-xfer.c
+++ b/page-xfer.c
@@ -549,6 +549,11 @@ static int write_pagehole_loc(struct page_xfer *xfer, struct iovec *iov)
 
 static void close_page_xfer(struct page_xfer *xfer)
 {
+	if (xfer->parent != NULL) {
+		xfer->parent->close(xfer->parent);
+		xfree(xfer->parent);
+		xfer->parent = NULL;
+	}
 	close(xfer->fd_pg);
 	close(xfer->fd);
 }
@@ -632,6 +637,8 @@ static int open_page_local_xfer(struct page_xfer *xfer, int fd_type, long id)
 		int ret;
 		int pfd;
 
+		xfer->parent = NULL;
+
 		pfd = openat(get_service_fd(IMG_FD_OFF), CR_PARENT_LINK, O_RDONLY);
 		if (pfd < 0 && errno == ENOENT)
 			goto out;
-- 
1.8.3.2



More information about the CRIU mailing list