Re: [alsa-devel] [PATCH v2] ASoC: Intel: Skylake: prevent memory leak in snd_skl_parse_uuids

2019-09-27 Thread Pierre-Louis Bossart
On 9/27/19 3:39 PM, Andy Shevchenko wrote: On Fri, Sep 27, 2019 at 7:39 PM Pierre-Louis Bossart wrote: 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

Re: [alsa-devel] [PATCH v2] ASoC: Intel: Skylake: prevent memory leak in snd_skl_parse_uuids

2019-09-27 Thread Andy Shevchenko
On Fri, Sep 27, 2019 at 7:39 PM Pierre-Louis Bossart wrote: > > 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 secon

Re: [alsa-devel] [PATCH v2] ASoC: Intel: Skylake: prevent memory leak in snd_skl_parse_uuids

2019-09-27 Thread Pierre-Louis Bossart
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 alloca

Re: [PATCH v2] ASoC: Intel: Skylake: prevent memory leak in snd_skl_parse_uuids

2019-09-27 Thread Andy Shevchenko
On Fri, Sep 27, 2019 at 05:10:18PM +0200, Cezary Rojewski wrote: > I'm fine with solution #1 as I guess asking to wait for refactor is not an > option. Code deployment is delayed due to range of administrative decisions, > some of which should be uncovered on alsa-devel soon enough. The problem w

Re: [PATCH v2] ASoC: Intel: Skylake: prevent memory leak in snd_skl_parse_uuids

2019-09-27 Thread Cezary Rojewski
On 2019-09-27 15:14, Pierre-Louis Bossart wrote: On 9/26/19 9:55 PM, Navid Emamdoost wrote: On Wed, Sep 25, 2019 at 12:05:28PM -0500, Pierre-Louis Bossart wrote: On 9/25/19 11:19 AM, Navid Emamdoost wrote: In snd_skl_parse_uuids if allocation for module->instance_id fails, the allocated memory

Re: [PATCH v2] ASoC: Intel: Skylake: prevent memory leak in snd_skl_parse_uuids

2019-09-27 Thread Pierre-Louis Bossart
On 9/26/19 9:55 PM, Navid Emamdoost wrote: On Wed, Sep 25, 2019 at 12:05:28PM -0500, Pierre-Louis Bossart wrote: On 9/25/19 11:19 AM, Navid Emamdoost wrote: In snd_skl_parse_uuids if allocation for module->instance_id fails, the allocated memory for module shoulde be released. I changes the all

Re: [PATCH v2] ASoC: Intel: Skylake: prevent memory leak in snd_skl_parse_uuids

2019-09-26 Thread Navid Emamdoost
On Wed, Sep 25, 2019 at 12:05:28PM -0500, Pierre-Louis Bossart wrote: > On 9/25/19 11:19 AM, Navid Emamdoost wrote: > > In snd_skl_parse_uuids if allocation for module->instance_id fails, the > > allocated memory for module shoulde be released. I changes the > > allocation for module to use devm_kz

Re: [PATCH v2] ASoC: Intel: Skylake: prevent memory leak in snd_skl_parse_uuids

2019-09-25 Thread Pierre-Louis Bossart
On 9/25/19 11:19 AM, Navid Emamdoost wrote: In snd_skl_parse_uuids if allocation for module->instance_id fails, the allocated memory for module shoulde be released. I changes the allocation for module to use devm_kzalloc to be resource_managed allocation and avoid the release in error path. if

[PATCH v2] ASoC: Intel: Skylake: prevent memory leak in snd_skl_parse_uuids

2019-09-25 Thread Navid Emamdoost
In snd_skl_parse_uuids if allocation for module->instance_id fails, the allocated memory for module shoulde be released. I changes the allocation for module to use devm_kzalloc to be resource_managed allocation and avoid the release in error path. Signed-off-by: Navid Emamdoost --- Changes in v2: