Hi Joseph,

On Wed, 09 Jul 2014 09:40:29 +0200, Joseph Schuchart wrote:
> [PATCH 1/3] perf script: Add missing calls to Py_DECREF for return values
>
> Signed-off-by: Joseph Schuchart <joseph.schuch...@tu-dresden.de>

Acked-by: Namhyung Kim <namhy...@kernel.org>

Thanks,
Namhyung


> ---
>  tools/perf/util/scripting-engines/trace-event-python.c | 12 ++++++++++--
>  1 file 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 1c41932..631aa85 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;
>  
>  static PyObject *main_module, *main_dict;
>  
> +static void handler_call_die(const char *handler_name) NORETURN;
>  static void handler_call_die(const char *handler_name)
>  {
>       PyErr_Print();
>       Py_FatalError("problem in Python trace event handler");
> +     // Py_FatalError does not return
> +     // but we have to make the compiler happy
> +     abort();
>  }
>  
>  /*
> @@ -97,6 +101,7 @@ static void define_value(enum print_arg_type field_type,
>               retval = PyObject_CallObject(handler, t);
>               if (retval == NULL)
>                       handler_call_die(handler_name);
> +             Py_DECREF(retval);
>       }
>  
>       Py_DECREF(t);
> @@ -143,6 +148,7 @@ static void define_field(enum print_arg_type field_type,
>               retval = PyObject_CallObject(handler, t);
>               if (retval == NULL)
>                       handler_call_die(handler_name);
> +             Py_DECREF(retval);
>       }
>  
>       Py_DECREF(t);
> @@ -334,6 +340,7 @@ static void python_process_tracepoint(struct perf_sample 
> *sample,
>               retval = PyObject_CallObject(handler, t);
>               if (retval == NULL)
>                       handler_call_die(handler_name);
> +             Py_DECREF(retval);
>       } else {
>               handler = PyDict_GetItemString(main_dict, "trace_unhandled");
>               if (handler && PyCallable_Check(handler)) {
> @@ -341,6 +348,7 @@ static void python_process_tracepoint(struct perf_sample 
> *sample,
>                       retval = PyObject_CallObject(handler, t);
>                       if (retval == NULL)
>                               handler_call_die("trace_unhandled");
> +                     Py_DECREF(retval);
>               }
>               Py_DECREF(dict);
>       }
> @@ -400,6 +408,7 @@ static void python_process_general_event(struct 
> perf_sample *sample,
>       retval = PyObject_CallObject(handler, t);
>       if (retval == NULL)
>               handler_call_die(handler_name);
> +     Py_DECREF(retval);
>  exit:
>       Py_DECREF(dict);
>       Py_DECREF(t);
> @@ -521,8 +530,7 @@ static int python_stop_script(void)
>       retval = PyObject_CallObject(handler, NULL);
>       if (retval == NULL)
>               handler_call_die("trace_end");
> -     else
> -             Py_DECREF(retval);
> +     Py_DECREF(retval);
>  out:
>       Py_XDECREF(main_dict);
>       Py_XDECREF(main_module);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to