diff options
Diffstat (limited to 'tools/perf/util/scripting-engines/trace-event-python.c')
-rw-r--r-- | tools/perf/util/scripting-engines/trace-event-python.c | 12 |
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 | ||
51 | static PyObject *main_module, *main_dict; | 51 | static PyObject *main_module, *main_dict; |
52 | 52 | ||
53 | static void handler_call_die(const char *handler_name) NORETURN; | ||
53 | static void handler_call_die(const char *handler_name) | 54 | static 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); | ||
430 | exit: | 439 | exit: |
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); | ||
553 | out: | 561 | out: |
554 | Py_XDECREF(main_dict); | 562 | Py_XDECREF(main_dict); |
555 | Py_XDECREF(main_module); | 563 | Py_XDECREF(main_module); |