Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753895AbbLOMhF (ORCPT ); Tue, 15 Dec 2015 07:37:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33581 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753252AbbLOMhC (ORCPT ); Tue, 15 Dec 2015 07:37:02 -0500 Date: Tue, 15 Dec 2015 13:36:58 +0100 From: Jiri Olsa To: Wang Nan Cc: acme@kernel.org, masami.hiramatsu.pt@hitachi.com, jolsa@kernel.org, linux-kernel@vger.kernel.org, pi3orama@163.com, lizefan@huawei.com, Arnaldo Carvalho de Melo , Namhyung Kim Subject: Re: [PATCH v5 02/14] perf tools: Prevent calling machine__delete() on non-allocated machine Message-ID: <20151215123658.GC20514@krava.brq.redhat.com> References: <1450089563-122430-1-git-send-email-wangnan0@huawei.com> <1450089563-122430-3-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1450089563-122430-3-git-send-email-wangnan0@huawei.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 670 Lines: 22 On Mon, Dec 14, 2015 at 10:39:11AM +0000, Wang Nan wrote: SNIP > @@ -137,12 +138,15 @@ void machine__exit(struct machine *machine) > void machine__delete(struct machine *machine) > { > machine__exit(machine); > - free(machine); > + if (machine->allocated) > + free(machine); > + else > + pr_warning("WARNING: delete a non-allocated machine. Skip.\n"); we used WARN_ONCE several times already in similar cases jirka -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/