diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-11-01 04:09:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-11-01 04:09:34 +0000 |
commit | 4de68785edd25915183b5f84f192ccaffd126a2f (patch) | |
tree | bc6c5cfb5ba70242a610199b36601974042967eb /Kill.c | |
parent | Adding upstream version 4.2+20230508. (diff) | |
download | mdadm-4de68785edd25915183b5f84f192ccaffd126a2f.tar.xz mdadm-4de68785edd25915183b5f84f192ccaffd126a2f.zip |
Adding upstream version 4.2+20231026.upstream/4.2+20231026
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | Kill.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -41,6 +41,7 @@ int Kill(char *dev, struct supertype *st, int force, int verbose, int noexcl) * 4 - failed to find a superblock. */ + bool free_super = false; int fd, rv = 0; if (force) @@ -52,8 +53,10 @@ int Kill(char *dev, struct supertype *st, int force, int verbose, int noexcl) dev); return 2; } - if (st == NULL) + if (st == NULL) { st = guess_super(fd); + free_super = true; + } if (st == NULL || st->ss->init_super == NULL) { if (verbose >= 0) pr_err("Unrecognised md component device - %s\n", dev); @@ -77,6 +80,10 @@ int Kill(char *dev, struct supertype *st, int force, int verbose, int noexcl) rv = 0; } } + if (free_super && st) { + st->ss->free_super(st); + free(st); + } close(fd); return rv; } |