On 13 October 2016 at 05:59, Stephane Eranian <eran...@google.com> wrote:
> diff --git a/tools/perf/jvmti/libjvmti.c b/tools/perf/jvmti/libjvmti.c
> index ac12e4b91a92..2d9bc04b79a8 100644
> --- a/tools/perf/jvmti/libjvmti.c
> +++ b/tools/perf/jvmti/libjvmti.c
> @@ -12,6 +12,17 @@
>  static int has_line_numbers;
>  void *jvmti_agent;
>
> +static void print_error(jvmtiEnv *jvmti, const char *msg, jvmtiError ret)
> +{
> +       char *err_msg = NULL;
> +       jvmtiError err;
> +       err = (*jvmti)->GetErrorName(jvmti, ret, &err_msg);
> +       if (err == JVMTI_ERROR_NONE) {
> +               warnx("%s failed with %s", msg, err_msg);
> +               (*jvmti)->Deallocate(jvmti, (unsigned char *)err_msg);
> +       }
> +}

Do we not need to release the memory for err_msg if the condition for
the 'if' statement evaluates to false?  Is it that we are going to
kill the process, so no need to release the memory?

--
Nilay

Reply via email to