Manage: Manage_add(): Fix memory leak
sysfs_read() allocates and populates a struct mdinfo, however the code forgot to free it again, before dropping the reference to the pointer. Reviewed-by: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
This commit is contained in:
parent
31dbeda730
commit
d209181d96
3
Manage.c
3
Manage.c
|
@ -944,10 +944,13 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
|
|||
}
|
||||
|
||||
if (strncmp(mdp->sysfs_array_state, "readonly", 8) != 0) {
|
||||
sysfs_free(mdp);
|
||||
pr_err("%s is not readonly, cannot add journal.\n", devname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
sysfs_free(mdp);
|
||||
|
||||
tst->ss->getinfo_super(tst, &mdi, NULL);
|
||||
if (mdi.journal_device_required == 0) {
|
||||
pr_err("%s does not support journal device.\n", devname);
|
||||
|
|
Loading…
Reference in New Issue