diff options
author | Blazej Kucman <blazej.kucman@intel.com> | 2022-12-20 12:07:51 +0100 |
---|---|---|
committer | Jes Sorensen <jes@trained-monkey.org> | 2022-12-28 15:59:06 +0100 |
commit | 434b3b9bb96a76dc12f693b64cf23b581781e20b (patch) | |
tree | 193f0aeec2ae3546aa06eed89105fea47049ed78 /Grow.c | |
parent | Update mdadm Monitor manual. (diff) | |
download | mdadm-434b3b9bb96a76dc12f693b64cf23b581781e20b.tar.xz mdadm-434b3b9bb96a76dc12f693b64cf23b581781e20b.zip |
Grow: fix possible memory leak.
Signed-off-by: Blazej Kucman <blazej.kucman@intel.com>
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
Diffstat (limited to 'Grow.c')
-rw-r--r-- | Grow.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -432,6 +432,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s) if (((disk.state & (1 << MD_DISK_WRITEMOSTLY)) == 0) && (strcmp(s->bitmap_file, "clustered") == 0)) { pr_err("%s disks marked write-mostly are not supported with clustered bitmap\n",devname); + free(mdi); return 1; } fd2 = dev_open(dv, O_RDWR); @@ -453,8 +454,10 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s) pr_err("failed to load super-block.\n"); } close(fd2); - if (rv) + if (rv) { + free(mdi); return 1; + } } if (offset_setable) { st->ss->getinfo_super(st, mdi, NULL); |