From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 016C2C433EF for ; Thu, 3 Feb 2022 16:43:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352331AbiBCQnL (ORCPT ); Thu, 3 Feb 2022 11:43:11 -0500 Received: from sin.source.kernel.org ([145.40.73.55]:44844 "EHLO sin.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242144AbiBCQnI (ORCPT ); Thu, 3 Feb 2022 11:43:08 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id C5B60CE2055; Thu, 3 Feb 2022 16:43:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C795AC340E8; Thu, 3 Feb 2022 16:43:04 +0000 (UTC) Date: Thu, 3 Feb 2022 11:43:03 -0500 From: Steven Rostedt To: Daniel Bristot de Oliveira Cc: linux-kernel@vger.kernel.org, linux-trace-devel@vger.kernel.org Subject: Re: [PATCH 3/8] rtla/osnoise_top: Fix segmentation fault when failing to enable -t Message-ID: <20220203114303.575910f8@gandalf.local.home> In-Reply-To: <20220203114126.3ec6b37d@gandalf.local.home> References: <3ef9cb911e9b51be55a874cacc847d44bca9877e.1643033113.git.bristot@kernel.org> <20220203114126.3ec6b37d@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 3 Feb 2022 11:41:26 -0500 Steven Rostedt wrote: > Wouldn't these four patches be more robust if you just initialized record > (and tool) to NULL, and change osnoise_destroy_tool() to: And if you do this, it should be one patch, not four. -- Steve > > void osnoise_destroy_tool(struct osnoise_tool *top) > { > if (!top) > return; > > trace_instance_destroy(&top->trace); > > if (top->context) > osnoise_put_context(top->context); > > free(top); > } > > Then you don't need these extra labels and if statements in the main code.