Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf inject: Fill in the missing session freeing after an error occurs

When an error occur an error value is just returned without freeing the
session. So allocating and freeing session have to be matched as a pair
even if an error occurs.

Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1435652124-22414-2-git-send-email-treeze.taeung@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Taeung Song and committed by
Arnaldo Carvalho de Melo
9fedfb0c ceb92913

+4 -3
+4 -3
tools/perf/builtin-inject.c
··· 630 630 if (inject.session == NULL) 631 631 return -1; 632 632 633 - if (symbol__init(&inject.session->header.env) < 0) 634 - return -1; 633 + ret = symbol__init(&inject.session->header.env); 634 + if (ret < 0) 635 + goto out_delete; 635 636 636 637 ret = __cmd_inject(&inject); 637 638 639 + out_delete: 638 640 perf_session__delete(inject.session); 639 - 640 641 return ret; 641 642 }