]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - tools/perf/util/trace-event-read.c
perf tools: Move extra string util functions to util/string2.h
[mirror_ubuntu-artful-kernel.git] / tools / perf / util / trace-event-read.c
index 27420159bf6944df76eb76a45943a4810e0ba972..8a9a677f75768205c47343c126813808e564a38a 100644 (file)
@@ -192,7 +192,7 @@ static int read_ftrace_printk(struct pevent *pevent)
        if (!size)
                return 0;
 
-       buf = malloc(size);
+       buf = malloc(size + 1);
        if (buf == NULL)
                return -1;
 
@@ -201,6 +201,8 @@ static int read_ftrace_printk(struct pevent *pevent)
                return -1;
        }
 
+       buf[size] = '\0';
+
        parse_ftrace_printk(pevent, buf, size);
 
        free(buf);