diff options
-rw-r--r-- | lib/raid/raid.c | 6 | ||||
-rw-r--r-- | lib/replicator/replicator.c | 8 | ||||
-rw-r--r-- | lib/thin/thin.c | 4 |
3 files changed, 13 insertions, 5 deletions
diff --git a/lib/raid/raid.c b/lib/raid/raid.c index 445146b0..3656dada 100644 --- a/lib/raid/raid.c +++ b/lib/raid/raid.c @@ -452,8 +452,10 @@ int init_multiple_segtypes(struct cmd_context *cmd, struct segtype_library *segl do { if ((segtype = raid_segtype_fn[i](cmd)) && - !lvm_register_segtype(seglib, segtype)) - return 0; + !lvm_register_segtype(seglib, segtype)) { + dm_free(segtype); + return_0; + } } while (raid_segtype_fn[++i]); return 1; diff --git a/lib/replicator/replicator.c b/lib/replicator/replicator.c index cfc9cd61..1203349e 100644 --- a/lib/replicator/replicator.c +++ b/lib/replicator/replicator.c @@ -772,8 +772,10 @@ int init_multiple_segtype(struct cmd_context *cmd, struct segtype_library *segli segtype->private = NULL; segtype->flags = SEG_REPLICATOR; - if (!lvm_register_segtype(seglib, segtype)) + if (!lvm_register_segtype(seglib, segtype)) { + dm_free(segtype); return_0; + } log_very_verbose("Initialised segtype: " REPLICATOR_MODULE); @@ -785,8 +787,10 @@ int init_multiple_segtype(struct cmd_context *cmd, struct segtype_library *segli segtype->private = NULL; segtype->flags = SEG_REPLICATOR_DEV; - if (!lvm_register_segtype(seglib, segtype)) + if (!lvm_register_segtype(seglib, segtype)) { + dm_free(segtype); return_0; + } log_very_verbose("Initialised segtype: " REPLICATOR_DEV_MODULE); diff --git a/lib/thin/thin.c b/lib/thin/thin.c index 96eee76c..d8d607d6 100644 --- a/lib/thin/thin.c +++ b/lib/thin/thin.c @@ -606,8 +606,10 @@ int init_multiple_segtypes(struct cmd_context *cmd, struct segtype_library *segl segtype->flags |= SEG_MONITORED; # endif /* DMEVENTD */ #endif - if (!lvm_register_segtype(seglib, segtype)) + if (!lvm_register_segtype(seglib, segtype)) { + dm_free(segtype); return_0; + } log_very_verbose("Initialised segtype: %s", segtype->name); } |