diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2012-02-28 14:23:41 +0000 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2012-02-28 14:23:41 +0000 |
commit | 54b2aadf402fa47880e3c493b97a440ca19f97a3 (patch) | |
tree | 888d7daf146fa44ebf92865208fd5a8e0c0cd20e | |
parent | 9e23089757f266be5ce4489b366be773855a5a28 (diff) | |
download | lvm2-54b2aadf402fa47880e3c493b97a440ca19f97a3.tar.gz lvm2-54b2aadf402fa47880e3c493b97a440ca19f97a3.tar.xz lvm2-54b2aadf402fa47880e3c493b97a440ca19f97a3.zip |
Revert free of allocated segtype
lvm_register_segtype takes ownership of segtype and call destructor
for it in error path.
-rw-r--r-- | WHATS_NEW | 1 | ||||
-rw-r--r-- | lib/raid/raid.c | 5 | ||||
-rw-r--r-- | lib/replicator/replicator.c | 10 | ||||
-rw-r--r-- | lib/thin/thin.c | 5 |
4 files changed, 9 insertions, 12 deletions
@@ -1,5 +1,6 @@ Version 2.02.94 - ==================================== + Revert free of allocated segtype in init segment error path (2.02.89). Test dm_hash_insert() failures in filter-persistent.c and fid_add_mda(). Ensure clvmd message is always \0 terminated after read. Better detection of missing dmeventd fifo connection (2.02.93). diff --git a/lib/raid/raid.c b/lib/raid/raid.c index 354ca508..097d36f4 100644 --- a/lib/raid/raid.c +++ b/lib/raid/raid.c @@ -456,10 +456,9 @@ 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)) { - dm_free(segtype); + !lvm_register_segtype(seglib, segtype)) + /* segtype is already destroyed */ return_0; - } } while (raid_segtype_fn[++i]); return 1; diff --git a/lib/replicator/replicator.c b/lib/replicator/replicator.c index 1203349e..2571e813 100644 --- a/lib/replicator/replicator.c +++ b/lib/replicator/replicator.c @@ -772,10 +772,9 @@ 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)) { - dm_free(segtype); + if (!lvm_register_segtype(seglib, segtype)) + /* segtype is already destroyed */ return_0; - } log_very_verbose("Initialised segtype: " REPLICATOR_MODULE); @@ -787,10 +786,9 @@ 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)) { - dm_free(segtype); + if (!lvm_register_segtype(seglib, segtype)) + /* segtype is already destroyed */ return_0; - } log_very_verbose("Initialised segtype: " REPLICATOR_DEV_MODULE); diff --git a/lib/thin/thin.c b/lib/thin/thin.c index ccf0f8da..65b130b8 100644 --- a/lib/thin/thin.c +++ b/lib/thin/thin.c @@ -607,10 +607,9 @@ 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)) { - dm_free(segtype); + if (!lvm_register_segtype(seglib, segtype)) + /* segtype is already destroyed */ return_0; - } log_very_verbose("Initialised segtype: %s", segtype->name); } |