summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2012-01-25 21:54:00 +0000
committerZdenek Kabelac <zkabelac@redhat.com>2012-01-25 21:54:00 +0000
commita980f56d2aea6d1aa2fae740187b62f59e33a761 (patch)
treee98d8ad5dbb8a0799a907477b0d7a46b467f949d /lib
parent1ef10bd81afc97ac0763383c7083d25d8c2be18c (diff)
downloadlvm2-a980f56d2aea6d1aa2fae740187b62f59e33a761.tar.gz
lvm2-a980f56d2aea6d1aa2fae740187b62f59e33a761.tar.xz
lvm2-a980f56d2aea6d1aa2fae740187b62f59e33a761.zip
Free allocated segment type in error path
Diffstat (limited to 'lib')
-rw-r--r--lib/raid/raid.c6
-rw-r--r--lib/replicator/replicator.c8
-rw-r--r--lib/thin/thin.c4
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);
}