It can return NULL, in which case we should bail out and remove the
directory created with mkdtemp(), which is stored in the "__tempdir"
variable, not in "tempdir".
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Fixes: 8e5dc848356e ("perf test: Add a test case for SDT event")
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
        }
        /* Note that buildid_dir must be an absolute path */
        tempdir = realpath(__tempdir, NULL);
+       if (tempdir == NULL)
+               goto error_rmdir;
 
        /* At first, scan itself */
        set_buildid_dir(tempdir);
 
 error_rmdir:
        /* Cleanup temporary buildid dir */
-       rm_rf(tempdir);
+       rm_rf(__tempdir);
 error:
        free(tempdir);
        free(myself);