Skip to contentSkip to conversation

Assemble: fix redundant memory free

PATCH Applied Kinga Tanska 3 participants 3 messages Sep 12, 2023 – Oct 26, 2023 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Assemble: fix redundant memory free

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.

---
 Assemble.c | 2 --
 1 file changed, 2 deletions(-)
Assemble.c +0 -2
index 61e8cd17..5be58e40 100644
@@ -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;
Signature · 1 line
2.26.2
#1 lore raw
Quoted 17 lines · On Tue, 12 Sep 2023 04:27:01 +0200 Kinga Tanska <[email protected]> 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.

---
 Assemble.c | 2 --
 1 file changed, 2 deletions(-)
Assemble.c +0 -0
index 61e8cd17..5be58e40 100644

Assemble.c static int select_devices(struct mddev_dev *devlist, · line 433

Quoted 8 lines
Assemble.c +0 -2
@@ -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

Applied
#2 lore raw
Quoted 21 lines · Mariusz Tkaczyk
Quoted 18 lines · On Tue, 12 Sep 2023 04:27:01 +0200 Kinga Tanska <[email protected]> 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.

---
 Assemble.c | 2 --
 1 file changed, 2 deletions(-)
Assemble.c +0 -0
index 61e8cd17..5be58e40 100644
@@ -428,8 +428,6 @@ static int select_devices(struct mddev_dev *devlist,
 
Quoted 10 lines

Assemble.c static int select_devices(struct mddev_dev *devlist, · line 433

Quoted 7 lines
Assemble.c +0 -2
 			/* 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