Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 29204b2e authored by Puranam V G Tejaswi's avatar Puranam V G Tejaswi
Browse files

msm: kgsl: Free the memory allocated for pages array in failure case



kgsl_system_alloc_pages and kgsl_pool_alloc_pages allocate memory for
pages array. This memory is not freed in kgsl_alloc_secure_pages in
some failure cases. Free the allocated memory in case of failure to
avoid memory leak issues.

Change-Id: Ifed2573506d549f60d01f8d3ba06cbabdc9878e0
Signed-off-by: default avatarPuranam V G Tejaswi <pvgtejas@codeaurora.org>
parent 07071b6c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1170,6 +1170,7 @@ static int kgsl_alloc_secure_pages(struct kgsl_device *device,
	sgt = kzalloc(sizeof(*sgt), GFP_KERNEL);
	if (!sgt) {
		kgsl_pool_free_pages(pages, count);
		kvfree(pages);
		return -ENOMEM;
	}

@@ -1177,6 +1178,7 @@ static int kgsl_alloc_secure_pages(struct kgsl_device *device,
	if (ret) {
		kfree(sgt);
		kgsl_pool_free_pages(pages, count);
		kvfree(pages);
		return ret;
	}