Commit 5bb07682 authored by Hui Tang's avatar Hui Tang Committed by Yipeng Zou
Browse files

sched: Fix memory leak on error branch

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7EBNA


CVE: NA

-------------------------------

Fix memory leak on error branch for smart grid.

Fixes: 713cfd26 ("sched: Introduce smart grid scheduling strategy for cfs")
Signed-off-by: default avatarHui Tang <tanghui20@huawei.com>
Reviewed-by: default avatarZhang Qiao <zhangqiao22@huawei.com>
Signed-off-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
Signed-off-by: default avatarYipeng Zou <zouyipeng@huawei.com>
parent 33154fb3
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -6156,7 +6156,6 @@ static int init_affinity_domains(struct affinity_domain *ad)
	}

	if (!sd) {
		ad->dcount = 0;
		rcu_read_unlock();
		return -EINVAL;
	}
@@ -6164,9 +6163,11 @@ static int init_affinity_domains(struct affinity_domain *ad)

	for (i = 0; i < dcount; i++) {
		ad->domains[i] = kmalloc(sizeof(cpumask_t), GFP_KERNEL);
		if (!ad->domains[i])
		if (!ad->domains[i]) {
			ad->dcount = i;
			goto err;
		}
	}

	rcu_read_lock();
	idlest = sd_find_idlest_group(sd);