1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

raid: add free for error path

Recent patch forget to release now allocated 'dso' on error path.
This commit is contained in:
Zdenek Kabelac 2018-02-25 16:20:30 +01:00
parent 9bfc8881cb
commit 261e6c3df6

View File

@ -655,6 +655,7 @@ int init_multiple_segtypes(struct cmd_context *cmd, struct segtype_library *segl
char *dso = NULL;
unsigned i;
uint64_t monitored = 0;
int r = 1;
#ifdef DEVMAPPER_SUPPORT
# ifdef DMEVENTD
@ -667,11 +668,14 @@ int init_multiple_segtypes(struct cmd_context *cmd, struct segtype_library *segl
for (i = 0; i < DM_ARRAY_SIZE(_raid_types); ++i)
if ((segtype = _init_raid_segtype(cmd, &_raid_types[i], dso, monitored)) &&
!lvm_register_segtype(seglib, segtype))
!lvm_register_segtype(seglib, segtype)) {
/* segtype is already destroyed */
return_0;
stack;
r = 0;
break;
}
dm_free(dso);
return 1;
return r;
}