• Jiri Olsa's avatar
    perf session: Fix double free in perf_data__close · befa09b6
    Jiri Olsa authored
    We can't call perf_data__close and subsequently perf_session__delete,
    because it will call perf_data__close again and cause double free for
    data->file.path.
    
      $ perf report -i .
      incompatible file format (rerun with -v to learn more)
      free(): double free detected in tcache 2
      Aborted (core dumped)
    
    In fact we don't need to call perf_data__close at all, because at the
    time the got out_close is reached, session->data is already initialized,
    so the perf_data__close call will be triggered from
    perf_session__delete.
    Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Jonas Rabenstein <jonas.rabenstein@studium.uni-erlangen.de>
    Cc: Nageswara R Sastry <nasastry@in.ibm.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
    Fixes: 2d4f2799 ("perf data: Add global path holder")
    Link: http://lkml.kernel.org/r/20190305152536.21035-8-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    befa09b6
session.c 61.1 KB