summaryrefslogtreecommitdiffstats
path: root/Examine.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-11-09 11:40:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-11-09 11:40:59 +0000
commitad73653d36c9bd59872479e3c41f8942c70945b9 (patch)
treef184315b3ad68109e86aa4bd5bba3de919bfa3e3 /Examine.c
parentAdding upstream version 4.3+20240723. (diff)
downloadmdadm-ad73653d36c9bd59872479e3c41f8942c70945b9.tar.xz
mdadm-ad73653d36c9bd59872479e3c41f8942c70945b9.zip
Adding upstream version 4.3+20241108.upstream/4.3+20241108
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'Examine.c')
-rw-r--r--Examine.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/Examine.c b/Examine.c
index c9605a6..036b7a5 100644
--- a/Examine.c
+++ b/Examine.c
@@ -22,14 +22,16 @@
* Email: <neilb@suse.de>
*/
-#include "mdadm.h"
#include "dlink.h"
+#include "mdadm.h"
+#include "md_u.h"
+#include "md_p.h"
+#include "xmalloc.h"
#if ! defined(__BIG_ENDIAN) && ! defined(__LITTLE_ENDIAN)
#error no endian defined
#endif
-#include "md_u.h"
-#include "md_p.h"
+
int Examine(struct mddev_dev *devlist,
struct context *c,
struct supertype *forcest)
@@ -111,8 +113,10 @@ int Examine(struct mddev_dev *devlist,
close(fd);
if (err) {
- if (st)
+ if (st) {
st->ss->free_super(st);
+ free(st);
+ }
continue;
}
@@ -152,19 +156,24 @@ int Examine(struct mddev_dev *devlist,
if (st->ss->export_examine_super)
st->ss->export_examine_super(st);
st->ss->free_super(st);
+ free(st);
} else {
printf("%s:\n",devlist->devname);
st->ss->examine_super(st, c->homehost);
st->ss->free_super(st);
+ free(st);
}
}
if (c->brief) {
- struct array *ap;
- for (ap = arrays; ap; ap = ap->next) {
+ struct array *ap = arrays, *next;
+
+ while (ap) {
char sep='=';
char *d;
int newline = 0;
+ next = ap->next;
+
ap->st->ss->brief_examine_super(ap->st, c->verbose > 0);
if (ap->spares && !ap->st->ss->external)
newline += printf(" spares=%d", ap->spares);
@@ -182,10 +191,15 @@ int Examine(struct mddev_dev *devlist,
printf("\n");
ap->st->ss->brief_examine_subarrays(ap->st, c->verbose);
}
- ap->st->ss->free_super(ap->st);
- /* FIXME free ap */
if (ap->spares || c->verbose > 0)
printf("\n");
+
+ ap->st->ss->free_super(ap->st);
+ free(ap->st);
+ dl_free_all(ap->devs);
+ free(ap);
+
+ ap = next;
}
}
return rv;