]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
perf kmem: Fix memory leak in compact_gfp_flags()
authorYunfeng Ye <yeyunfeng@huawei.com>
Wed, 16 Oct 2019 08:38:45 +0000 (16:38 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 26 Nov 2019 12:15:56 +0000 (13:15 +0100)
commita568c348cbfbf85254664137177df428b0bbe3a8
treefcb4884694d50adbc89d2cd2f96f47037be7131e
parenta92a49668610438c39713f35a083c7eb9075a881
perf kmem: Fix memory leak in compact_gfp_flags()

BugLink: https://bugs.launchpad.net/bugs/1853208
[ Upstream commit 1abecfcaa7bba21c9985e0136fa49836164dd8fd ]

The memory @orig_flags is allocated by strdup(), it is freed on the
normal path, but leak to free on the error path.

Fix this by adding free(orig_flags) on the error path.

Fixes: 0e11115644b3 ("perf kmem: Print gfp flags in human readable string")
Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Feilong Lin <linfeilong@huawei.com>
Cc: Hu Shiyuan <hushiyuan@huawei.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/f9e9f458-96f3-4a97-a1d5-9feec2420e07@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
tools/perf/builtin-kmem.c