perf tools: Fix buffer allocation
authorEric Dumazet <eric.dumazet@gmail.com>
Thu, 24 Sep 2009 13:05:59 +0000 (15:05 +0200)
committerIngo Molnar <mingo@elte.hu>
Thu, 24 Sep 2009 13:11:23 +0000 (15:11 +0200)
"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 <eric.dumazet@gmail.com>
Cc: <stable@kernel.org>
LKML-Reference: <4ABB6EB7.7000002@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
tools/perf/util/module.c

index 8f81622073e17c7a92f218c74657d634d73b4676..0d8c85defcd2b02b1c772e323b9262346d471d33 100644 (file)
@@ -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;