]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - tools/perf/arch/x86/util/header.c
perf record: Fix failed memory allocation for get_cpuid_str
[mirror_ubuntu-bionic-kernel.git] / tools / perf / arch / x86 / util / header.c
index b626d2bad9f18865ab385ea26c6751f2f829e904..fb0d71afee8bb4a9d7680c09271f903894b31fa7 100644 (file)
@@ -70,7 +70,7 @@ get_cpuid_str(struct perf_pmu *pmu __maybe_unused)
 {
        char *buf = malloc(128);
 
-       if (__get_cpuid(buf, 128, "%s-%u-%X$") < 0) {
+       if (buf && __get_cpuid(buf, 128, "%s-%u-%X$") < 0) {
                free(buf);
                return NULL;
        }