[CRIU] [PATCH 3/4] autofs: free leaked info in autofs_mount on error path

Stanislav Kinsburskiy skinsbursky at virtuozzo.com
Thu Mar 24 04:32:16 PDT 2016


Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
 criu/autofs.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/criu/autofs.c b/criu/autofs.c
index c26f861..975631c 100644
--- a/criu/autofs.c
+++ b/criu/autofs.c
@@ -882,25 +882,25 @@ int autofs_mount(struct mount_info *mi, const char *source, const
 	 */
 	if (stat(mi->mountpoint, &buf) < 0) {
 		pr_perror("Failed to stat %s", mi->mountpoint);
-		goto umount;
+		goto free_info;
 	}
 	info->mnt_dev = buf.st_dev;
 
 	/* We need to create dentries for nested mounts */
 	ret = autofs_populate_mount(mi, entry);
 	if (ret < 0)
-		goto umount;
+		goto free_info;
 
 	/* In case of catatonic mounts all we need as the function call below */
 	ret = autofs_post_mount(mi->mountpoint, buf.st_dev, entry->timeout);
 	if (ret < 0)
-		goto umount;
+		goto free_info;
 
 	/* Otherwise we have to add shared object creation callback */
 	if (entry->fd != AUTOFS_CATATONIC_FD) {
 		ret = add_post_prepare_cb(autofs_add_mount_info, mi);
 		if (ret < 0)
-			goto umount;
+			goto free_info;
 	}
 
 	mi->private = info;
@@ -910,6 +910,8 @@ close_pipe:
 	close(control_pipe[0]);
 	return ret;
 
+free_info:
+	free(info);
 umount:
 	if (umount(mi->mountpoint) < 0)
 		pr_perror("Failed to umount %s", mi->mountpoint);



More information about the CRIU mailing list