Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756663AbcJMUWP (ORCPT ); Thu, 13 Oct 2016 16:22:15 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:35158 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753764AbcJMUWG (ORCPT ); Thu, 13 Oct 2016 16:22:06 -0400 MIME-Version: 1.0 In-Reply-To: <1476356383-30100-2-git-send-email-eranian@google.com> References: <1476356383-30100-1-git-send-email-eranian@google.com> <1476356383-30100-2-git-send-email-eranian@google.com> From: Nilay Vaish Date: Thu, 13 Oct 2016 15:05:40 -0500 Message-ID: Subject: Re: [PATCH 1/9] perf/jit: improve error messages from JVMTI To: Stephane Eranian Cc: Linux Kernel list , Arnaldo Carvalho de Melo , jolsa@redhat.com, peterz@infradead.org, mingo@elte.hu, anton@ozlabs.org, namhyung@kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 931 Lines: 26 On 13 October 2016 at 05:59, Stephane Eranian 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