From df572ff0bc8b2b8911366ec708912da6802ca455 Mon Sep 17 00:00:00 2001 From: Amir Samuelov Date: Sun, 27 Aug 2017 16:02:03 +0300 Subject: [PATCH] spcom: fix memory leak in spcom register client / register service API free allocated memory in error handling of spcom_register_client() and spcom_register_service() kernel API. Change-Id: Ieb5787cb1a11d4b3320237fa8cdde3dc357d9084 Signed-off-by: Amir Samuelov --- drivers/soc/qcom/spcom.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/soc/qcom/spcom.c b/drivers/soc/qcom/spcom.c index bf89cb63ce4a..6c1e781d6eb9 100644 --- a/drivers/soc/qcom/spcom.c +++ b/drivers/soc/qcom/spcom.c @@ -1138,6 +1138,7 @@ struct spcom_client *spcom_register_client(struct spcom_client_info *info) ch = spcom_find_channel_by_name(name); if (!ch) { pr_err("channel %s doesn't exist, load App first.\n", name); + kfree(client); return NULL; } @@ -1325,6 +1326,7 @@ struct spcom_server *spcom_register_service(struct spcom_service_info *info) ch = spcom_find_channel_by_name(name); if (!ch) { pr_err("channel %s doesn't exist, load App first.\n", name); + kfree(server); return NULL; }