msm: mdss: Properly free memory in error case

Free previously allocated memory in error return cases to avoid
memory leak.

CRs-Fixed: 1005989
Change-Id: I9676eb2c75e7be42b1b1901194ba5c2a206dbeb3
Signed-off-by: Ping Li <pingli@codeaurora.org>
This commit is contained in:
Ping Li 2016-04-20 17:09:36 -07:00 committed by Gerrit - the friendly Code Review server
parent 09997661e4
commit 7884938777

View file

@ -668,8 +668,10 @@ static ssize_t mdss_dsi_cmd_state_write(struct file *file,
return -ENOMEM;
}
if (copy_from_user(input, p, count))
if (copy_from_user(input, p, count)) {
kfree(input);
return -EFAULT;
}
input[count-1] = '\0';
if (strnstr(input, "dsi_hs_mode", strlen("dsi_hs_mode")))