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 X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B03F5C4360C for ; Fri, 27 Sep 2019 16:37:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 805A621850 for ; Fri, 27 Sep 2019 16:37:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727683AbfI0Qh0 (ORCPT ); Fri, 27 Sep 2019 12:37:26 -0400 Received: from mga09.intel.com ([134.134.136.24]:33225 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726251AbfI0Qh0 (ORCPT ); Fri, 27 Sep 2019 12:37:26 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Sep 2019 09:37:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,556,1559545200"; d="scan'208";a="189493023" Received: from sanyamba-mobl.amr.corp.intel.com (HELO [10.254.4.17]) ([10.254.4.17]) by fmsmga008.fm.intel.com with ESMTP; 27 Sep 2019 09:37:24 -0700 Subject: Re: [alsa-devel] [PATCH v2] ASoC: Intel: Skylake: prevent memory leak in snd_skl_parse_uuids To: Andy Shevchenko , Cezary Rojewski Cc: alsa-devel@alsa-project.org, Greg Kroah-Hartman , Jie Yang , Mark Brown , Takashi Iwai , kjlu@umn.edu, Liam Girdwood , emamd001@umn.edu, smccaman@umn.edu, Thomas Gleixner , Enrico Weigelt , linux-kernel@vger.kernel.org, Navid Emamdoost References: <20190925161922.22479-1-navid.emamdoost@gmail.com> <13f4bd40-dbaa-e24e-edca-4b4acff9d9c5@linux.intel.com> <20190927025526.GD22969@cs-dulles.cs.umn.edu> <6966df25-e82c-1abe-6a0f-ff497dcda23b@intel.com> <20190927153304.GS32742@smile.fi.intel.com> From: Pierre-Louis Bossart Message-ID: <2e8ef4df-9c5f-f6e0-23ee-32d3bc555330@linux.intel.com> Date: Fri, 27 Sep 2019 11:37:24 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190927153304.GS32742@smile.fi.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > The problem with solution #1 is freeing orphaned pointer. It will work, > but it's simple is not okay from object life time prospective. ?? I don't get your point at all Andy. Two allocations happens in a loop and if the second fails, you free the first and then jump to free everything allocated in the previous iterations. what am I missing?