From: cym Date: Tue, 17 Sep 2013 06:18:07 +0000 (+0800) Subject: RK31/RK30:add vfree(buf); to fix memory leaks in video_state_write(); X-Git-Tag: firefly_0821_release~6622 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=db38a404c20a08ed998562da775ff169a03758c8;p=firefly-linux-kernel-4.4.55.git RK31/RK30:add vfree(buf); to fix memory leaks in video_state_write(); --- diff --git a/arch/arm/plat-rk/ddr_freq.c b/arch/arm/plat-rk/ddr_freq.c index 5ec16e38b7ef..52d01020dca0 100755 --- a/arch/arm/plat-rk/ddr_freq.c +++ b/arch/arm/plat-rk/ddr_freq.c @@ -302,8 +302,10 @@ static ssize_t video_state_write(struct file *file, const char __user *buffer, cookie_pot = buf; if (count < 1) + vfree(buf); return count; if (copy_from_user(cookie_pot, buffer, count)) { + vfree(buf); return -EFAULT; } @@ -349,10 +351,12 @@ static ssize_t video_state_write(struct file *file, const char __user *buffer, } break; default: + vfree(buf); return -EINVAL; } ddr.video_state = state; + vfree(buf); return count; }