mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
soc: rockchip: system_monitor: Fix memleak in rockchip_parse_video_info
unreferenced object 0xffffffc068ef4d00 (size 128):
comm "MsgQueue", pid 6134, jiffies 4296734025 (age 942.967s)
hex dump (first 32 bytes):
31 00 77 69 64 74 68 00 31 39 32 30 00 68 65 69 1.width.1920.hei
67 68 74 00 31 30 38 38 00 69 73 68 65 76 63 00 ght.1088.ishevc.
backtrace:
[<00000000a20494fa>] __kmalloc_track_caller+0x2c0/0x350
[<00000000c761fedd>] kstrdup+0x38/0x68
[<0000000007e9cfe0>] rockchip_parse_video_info+0x8c/0x110
[<000000009380a4ea>] rockchip_update_system_status+0x6c/0x208
[<000000002366d676>] status_store+0x1c/0x38
[<00000000262b2d89>] kobj_attr_store+0x14/0x28
[<0000000082de5cb2>] sysfs_kf_write+0x48/0x58
[<000000004cf22a2f>] kernfs_fop_write+0xec/0x1e8
[<000000002ce798af>] __vfs_write+0x34/0x158
[<00000000b71f587d>] vfs_write+0xb4/0x1c8
[<000000004acb036b>] ksys_write+0x64/0xe0
[<000000003a4572a8>] __arm64_sys_write+0x14/0x20
[<000000004373535e>] el0_svc_common.constprop.0+0xb8/0x178
[<00000000b1dff00e>] el0_svc_compat_handler+0x18/0x20
[<000000002ce195f8>] el0_svc_compat+0x8/0x34
[<000000005ee63479>] 0xffffffffffffffff
Change-Id: Ie5e5728c4e0a067cad8178ad46f02fa21888e24e
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
This commit is contained in:
@@ -201,7 +201,7 @@ static struct video_info *rockchip_parse_video_info(const char *buf)
|
||||
{
|
||||
struct video_info *video_info;
|
||||
const char *cp = buf;
|
||||
char *str;
|
||||
char *str, *p;
|
||||
int ntokens = 0;
|
||||
|
||||
while ((cp = strpbrk(cp + 1, ",")))
|
||||
@@ -216,12 +216,13 @@ static struct video_info *rockchip_parse_video_info(const char *buf)
|
||||
INIT_LIST_HEAD(&video_info->node);
|
||||
|
||||
str = kstrdup(buf, GFP_KERNEL);
|
||||
strsep(&str, ",");
|
||||
video_info->width = rockchip_get_video_param(&str);
|
||||
video_info->height = rockchip_get_video_param(&str);
|
||||
video_info->ishevc = rockchip_get_video_param(&str);
|
||||
video_info->videoFramerate = rockchip_get_video_param(&str);
|
||||
video_info->streamBitrate = rockchip_get_video_param(&str);
|
||||
p = str;
|
||||
strsep(&p, ",");
|
||||
video_info->width = rockchip_get_video_param(&p);
|
||||
video_info->height = rockchip_get_video_param(&p);
|
||||
video_info->ishevc = rockchip_get_video_param(&p);
|
||||
video_info->videoFramerate = rockchip_get_video_param(&p);
|
||||
video_info->streamBitrate = rockchip_get_video_param(&p);
|
||||
pr_debug("%c,width=%d,height=%d,ishevc=%d,videoFramerate=%d,streamBitrate=%d\n",
|
||||
buf[0],
|
||||
video_info->width,
|
||||
|
||||
Reference in New Issue
Block a user