From: Eric Dumazet Date: Thu, 24 Sep 2009 13:05:59 +0000 (+0200) Subject: perf tools: Fix buffer allocation X-Git-Tag: Ubuntu-5.4-5.4.0-11.14~28519^2~1 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=a255a9981a8566a1efabec983b7811e937e662d2;p=mirror_ubuntu-focal-kernel.git perf tools: Fix buffer allocation "perf top" cores dump on my dev machine, if run from a directory where vmlinux is present: *** glibc detected *** malloc(): memory corruption: 0x085670d0 *** Signed-off-by: Eric Dumazet Cc: LKML-Reference: <4ABB6EB7.7000002@gmail.com> Signed-off-by: Ingo Molnar --- diff --git a/tools/perf/util/module.c b/tools/perf/util/module.c index 8f81622073e1..0d8c85defcd2 100644 --- a/tools/perf/util/module.c +++ b/tools/perf/util/module.c @@ -423,7 +423,7 @@ static int mod_dso__load_module_paths(struct mod_dso *self) len += strlen(uts.release); len += strlen("/modules.dep"); - dpath = calloc(1, len); + dpath = calloc(1, len + 1); if (dpath == NULL) return err;