aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/scripting-engines/trace-event-python.c
diff options
context:
space:
mode:
authorJoseph Schuchart <joseph.schuchart@tu-dresden.de>2014-07-09 10:16:31 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-07-16 16:57:33 -0400
commit05f832e3a267d6e45d092595bdf9339d127ea137 (patch)
treeff186844ed4ad0b9c375901caeadfdf1a18dde9f /tools/perf/util/scripting-engines/trace-event-python.c
parent3be8e2a0a53c3179a44a933614f6a893da0b5c19 (diff)
perf script: Add missing calls to Py_DECREF for return values
Signed-off-by: Joseph Schuchart <joseph.schuchart@tu-dresden.de> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Thomas Ilsche <thomas.ilsche@tu-dresden.de> Link: http://lkml.kernel.org/r/53BD4EBF.5050407@tu-dresden.de Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/scripting-engines/trace-event-python.c')
-rw-r--r--tools/perf/util/scripting-engines/trace-event-python.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index e55b65a65558..b6c1a69f2b18 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -50,10 +50,14 @@ static int zero_flag_atom;
50 50
51static PyObject *main_module, *main_dict; 51static PyObject *main_module, *main_dict;
52 52
53static void handler_call_die(const char *handler_name) NORETURN;
53static void handler_call_die(const char *handler_name) 54static void handler_call_die(const char *handler_name)
54{ 55{
55 PyErr_Print(); 56 PyErr_Print();
56 Py_FatalError("problem in Python trace event handler"); 57 Py_FatalError("problem in Python trace event handler");
58 // Py_FatalError does not return
59 // but we have to make the compiler happy
60 abort();
57} 61}
58 62
59/* 63/*
@@ -97,6 +101,7 @@ static void define_value(enum print_arg_type field_type,
97 retval = PyObject_CallObject(handler, t); 101 retval = PyObject_CallObject(handler, t);
98 if (retval == NULL) 102 if (retval == NULL)
99 handler_call_die(handler_name); 103 handler_call_die(handler_name);
104 Py_DECREF(retval);
100 } 105 }
101 106
102 Py_DECREF(t); 107 Py_DECREF(t);
@@ -143,6 +148,7 @@ static void define_field(enum print_arg_type field_type,
143 retval = PyObject_CallObject(handler, t); 148 retval = PyObject_CallObject(handler, t);
144 if (retval == NULL) 149 if (retval == NULL)
145 handler_call_die(handler_name); 150 handler_call_die(handler_name);
151 Py_DECREF(retval);
146 } 152 }
147 153
148 Py_DECREF(t); 154 Py_DECREF(t);
@@ -361,6 +367,7 @@ static void python_process_tracepoint(struct perf_sample *sample,
361 retval = PyObject_CallObject(handler, t); 367 retval = PyObject_CallObject(handler, t);
362 if (retval == NULL) 368 if (retval == NULL)
363 handler_call_die(handler_name); 369 handler_call_die(handler_name);
370 Py_DECREF(retval);
364 } else { 371 } else {
365 handler = PyDict_GetItemString(main_dict, "trace_unhandled"); 372 handler = PyDict_GetItemString(main_dict, "trace_unhandled");
366 if (handler && PyCallable_Check(handler)) { 373 if (handler && PyCallable_Check(handler)) {
@@ -368,6 +375,7 @@ static void python_process_tracepoint(struct perf_sample *sample,
368 retval = PyObject_CallObject(handler, t); 375 retval = PyObject_CallObject(handler, t);
369 if (retval == NULL) 376 if (retval == NULL)
370 handler_call_die("trace_unhandled"); 377 handler_call_die("trace_unhandled");
378 Py_DECREF(retval);
371 } 379 }
372 Py_DECREF(dict); 380 Py_DECREF(dict);
373 } 381 }
@@ -427,6 +435,7 @@ static void python_process_general_event(struct perf_sample *sample,
427 retval = PyObject_CallObject(handler, t); 435 retval = PyObject_CallObject(handler, t);
428 if (retval == NULL) 436 if (retval == NULL)
429 handler_call_die(handler_name); 437 handler_call_die(handler_name);
438 Py_DECREF(retval);
430exit: 439exit:
431 Py_DECREF(dict); 440 Py_DECREF(dict);
432 Py_DECREF(t); 441 Py_DECREF(t);
@@ -548,8 +557,7 @@ static int python_stop_script(void)
548 retval = PyObject_CallObject(handler, NULL); 557 retval = PyObject_CallObject(handler, NULL);
549 if (retval == NULL) 558 if (retval == NULL)
550 handler_call_die("trace_end"); 559 handler_call_die("trace_end");
551 else 560 Py_DECREF(retval);
552 Py_DECREF(retval);
553out: 561out:
554 Py_XDECREF(main_dict); 562 Py_XDECREF(main_dict);
555 Py_XDECREF(main_module); 563 Py_XDECREF(main_module);