diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 5606c0f08d95c1da85f75b1326f99cfc81e053eb..3fe01102607b164c1fb47a6be951fe0c02832875 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1540,6 +1540,8 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
 		if (!atomic_inc_not_zero(&root->top_cgroup.refcnt)) {
 			mutex_unlock(&cgroup_mutex);
 			mutex_unlock(&cgroup_tree_mutex);
+			kfree(opts.release_agent);
+			kfree(opts.name);
 			msleep(10);
 			goto retry;
 		}