diff mbox series

Assemble: fix redundant memory free

Message ID 20230912022701.948-1-kinga.tanska@intel.com (mailing list archive)
State Mainlined, archived
Delegated to: Jes Sorensen
Headers show
Series Assemble: fix redundant memory free | expand

Commit Message

Kinga Tanska Sept. 12, 2023, 2:27 a.m. UTC
Commit e9fb93af0f76 ("Fix memory leak in file Assemble")
fixes few memory leaks in Assemble, but it introduces
problem with assembling RAID volume. It was caused by
clearing metadata too fast, not only on fail in
select_devices() function.
This commit removes redundant memory free.

Signed-off-by: Kinga Tanska <kinga.tanska@intel.com>
---
 Assemble.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Mariusz Tkaczyk Sept. 12, 2023, 9:49 a.m. UTC | #1
On Tue, 12 Sep 2023 04:27:01 +0200
Kinga Tanska <kinga.tanska@intel.com> wrote:

> Commit e9fb93af0f76 ("Fix memory leak in file Assemble")
> fixes few memory leaks in Assemble, but it introduces
> problem with assembling RAID volume. It was caused by
> clearing metadata too fast, not only on fail in
> select_devices() function.
> This commit removes redundant memory free.
> 
> Signed-off-by: Kinga Tanska <kinga.tanska@intel.com>
> ---
>  Assemble.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/Assemble.c b/Assemble.c
> index 61e8cd17..5be58e40 100644
> --- a/Assemble.c
> +++ b/Assemble.c
> @@ -428,8 +428,6 @@ static int select_devices(struct mddev_dev *devlist,
>  
>  			/* make sure we finished the loop */
>  			tmpdev = NULL;
> -			free(st);
> -			st = NULL;
>  			goto loop;
>  		} else {
>  			content = *contentp;

Hi Jes,
It is a regression. Please merge it ASAP, it broke a a lot of our tests.

Thanks,
Mariusz
Jes Sorensen Oct. 26, 2023, 9:21 p.m. UTC | #2
On 9/12/23 05:49, Mariusz Tkaczyk wrote:
> On Tue, 12 Sep 2023 04:27:01 +0200
> Kinga Tanska <kinga.tanska@intel.com> wrote:
> 
>> Commit e9fb93af0f76 ("Fix memory leak in file Assemble")
>> fixes few memory leaks in Assemble, but it introduces
>> problem with assembling RAID volume. It was caused by
>> clearing metadata too fast, not only on fail in
>> select_devices() function.
>> This commit removes redundant memory free.
>>
>> Signed-off-by: Kinga Tanska <kinga.tanska@intel.com>
>> ---
>>  Assemble.c | 2 --
>>  1 file changed, 2 deletions(-)
>>
>> diff --git a/Assemble.c b/Assemble.c
>> index 61e8cd17..5be58e40 100644
>> --- a/Assemble.c
>> +++ b/Assemble.c
>> @@ -428,8 +428,6 @@ static int select_devices(struct mddev_dev *devlist,
>>  
>>  			/* make sure we finished the loop */
>>  			tmpdev = NULL;
>> -			free(st);
>> -			st = NULL;
>>  			goto loop;
>>  		} else {
>>  			content = *contentp;
> 
> Hi Jes,
> It is a regression. Please merge it ASAP, it broke a a lot of our tests.

Applied!

Sorry for missing this.

Thanks,
Jes
diff mbox series

Patch

diff --git a/Assemble.c b/Assemble.c
index 61e8cd17..5be58e40 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -428,8 +428,6 @@  static int select_devices(struct mddev_dev *devlist,
 
 			/* make sure we finished the loop */
 			tmpdev = NULL;
-			free(st);
-			st = NULL;
 			goto loop;
 		} else {
 			content = *contentp;