Blame SOURCES/0065-Grow-fix-possible-memory-leak.patch
|
|
37f2b0 |
From 434b3b9bb96a76dc12f693b64cf23b581781e20b Mon Sep 17 00:00:00 2001
|
|
|
37f2b0 |
From: Blazej Kucman <blazej.kucman@intel.com>
|
|
|
37f2b0 |
Date: Tue, 20 Dec 2022 12:07:51 +0100
|
|
|
37f2b0 |
Subject: [PATCH 65/83] Grow: fix possible memory leak.
|
|
|
37f2b0 |
|
|
|
37f2b0 |
Signed-off-by: Blazej Kucman <blazej.kucman@intel.com>
|
|
|
37f2b0 |
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
|
|
|
37f2b0 |
---
|
|
|
37f2b0 |
Grow.c | 5 ++++-
|
|
|
37f2b0 |
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
|
37f2b0 |
|
|
|
37f2b0 |
diff --git a/Grow.c b/Grow.c
|
|
|
37f2b0 |
index e362403a..b73ec2ae 100644
|
|
|
37f2b0 |
--- a/Grow.c
|
|
|
37f2b0 |
+++ b/Grow.c
|
|
|
37f2b0 |
@@ -432,6 +432,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
|
|
|
37f2b0 |
if (((disk.state & (1 << MD_DISK_WRITEMOSTLY)) == 0) &&
|
|
|
37f2b0 |
(strcmp(s->bitmap_file, "clustered") == 0)) {
|
|
|
37f2b0 |
pr_err("%s disks marked write-mostly are not supported with clustered bitmap\n",devname);
|
|
|
37f2b0 |
+ free(mdi);
|
|
|
37f2b0 |
return 1;
|
|
|
37f2b0 |
}
|
|
|
37f2b0 |
fd2 = dev_open(dv, O_RDWR);
|
|
|
37f2b0 |
@@ -453,8 +454,10 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
|
|
|
37f2b0 |
pr_err("failed to load super-block.\n");
|
|
|
37f2b0 |
}
|
|
|
37f2b0 |
close(fd2);
|
|
|
37f2b0 |
- if (rv)
|
|
|
37f2b0 |
+ if (rv) {
|
|
|
37f2b0 |
+ free(mdi);
|
|
|
37f2b0 |
return 1;
|
|
|
37f2b0 |
+ }
|
|
|
37f2b0 |
}
|
|
|
37f2b0 |
if (offset_setable) {
|
|
|
37f2b0 |
st->ss->getinfo_super(st, mdi, NULL);
|
|
|
37f2b0 |
--
|
|
|
37f2b0 |
2.38.1
|
|
|
37f2b0 |
|