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

Commit 6048a1db authored by Manoj Prabhu B's avatar Manoj Prabhu B Committed by Gerrit - the friendly Code Review server
Browse files

memshare: Fix possible memory leak



This patch frees up the dynamically allotted memory
when met with error condition and function return.

CRs-Fixed: 1106180
Change-Id: I01446fbdbb422dcb025ee50929b32f40a5a78681
Signed-off-by: default avatarManoj Prabhu B <bmanoj@codeaurora.org>
parent c1b67407
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -478,6 +478,8 @@ static int handle_alloc_generic_req(void *req_h, void *req, void *conn_h)
		pr_err("memshare: %s client not found, requested client: %d, proc_id: %d\n",
				__func__, alloc_req->client_id,
				alloc_req->proc_id);
		kfree(alloc_resp);
		alloc_resp = NULL;
		return -EINVAL;
	}

@@ -522,6 +524,9 @@ static int handle_alloc_generic_req(void *req_h, void *req, void *conn_h)
	if (rc < 0)
		pr_err("In %s, Error sending the alloc request: %d\n",
							__func__, rc);

	kfree(alloc_resp);
	alloc_resp = NULL;
	return rc;
}

@@ -639,6 +644,8 @@ static int handle_query_size_req(void *req_h, void *req, void *conn_h)
		pr_err("memshare: %s client not found, requested client: %d, proc_id: %d\n",
				__func__, query_req->client_id,
				query_req->proc_id);
		kfree(query_resp);
		query_resp = NULL;
		return -EINVAL;
	}

@@ -664,6 +671,8 @@ static int handle_query_size_req(void *req_h, void *req, void *conn_h)
		pr_err("In %s, Error sending the query request: %d\n",
							__func__, rc);

	kfree(query_resp);
	query_resp = NULL;
	return rc;
}