Re: [PATCH] pstore/ram: Fix memory leak in persistent_ram_new

From: Markus Elfring
Date: Fri Dec 13 2019 - 12:09:09 EST


> In the implementation of persistent_ram_new(), if the allocation for prz
> fails, "label" should be released as part of error handling.

How did you come to this conclusion?

I suggest to reconsider this patch because the mentioned string is passed by
a function parameter.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/pstore/ram_core.c?id=37d4e84f765bb3038ddfeebdc5d1cfd7e1ef688f#n561
https://elixir.bootlin.com/linux/v5.5-rc1/source/fs/pstore/ram_core.c#L561

I recognise other implementation details which could be improved here.
https://lore.kernel.org/lkml/97737d95-d6aa-d24f-1af0-9d4895ceaed2@xxxxxxxxxxxxxxxxxxxxx/
https://lkml.org/lkml/2017/8/16/645

Regards,
Markus