1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

Revert free of allocated segtype

lvm_register_segtype takes ownership of segtype and call destructor
for it in error path.
This commit is contained in:
Zdenek Kabelac 2012-02-28 14:23:41 +00:00
parent 3db3d4d895
commit 7ed8790301
4 changed files with 9 additions and 12 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.94 - 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(). Test dm_hash_insert() failures in filter-persistent.c and fid_add_mda().
Ensure clvmd message is always \0 terminated after read. Ensure clvmd message is always \0 terminated after read.
Better detection of missing dmeventd fifo connection (2.02.93). Better detection of missing dmeventd fifo connection (2.02.93).

View File

@ -456,10 +456,9 @@ int init_multiple_segtypes(struct cmd_context *cmd, struct segtype_library *segl
do { do {
if ((segtype = raid_segtype_fn[i](cmd)) && if ((segtype = raid_segtype_fn[i](cmd)) &&
!lvm_register_segtype(seglib, segtype)) { !lvm_register_segtype(seglib, segtype))
dm_free(segtype); /* segtype is already destroyed */
return_0; return_0;
}
} while (raid_segtype_fn[++i]); } while (raid_segtype_fn[++i]);
return 1; return 1;

View File

@ -772,10 +772,9 @@ int init_multiple_segtype(struct cmd_context *cmd, struct segtype_library *segli
segtype->private = NULL; segtype->private = NULL;
segtype->flags = SEG_REPLICATOR; segtype->flags = SEG_REPLICATOR;
if (!lvm_register_segtype(seglib, segtype)) { if (!lvm_register_segtype(seglib, segtype))
dm_free(segtype); /* segtype is already destroyed */
return_0; return_0;
}
log_very_verbose("Initialised segtype: " REPLICATOR_MODULE); 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->private = NULL;
segtype->flags = SEG_REPLICATOR_DEV; segtype->flags = SEG_REPLICATOR_DEV;
if (!lvm_register_segtype(seglib, segtype)) { if (!lvm_register_segtype(seglib, segtype))
dm_free(segtype); /* segtype is already destroyed */
return_0; return_0;
}
log_very_verbose("Initialised segtype: " REPLICATOR_DEV_MODULE); log_very_verbose("Initialised segtype: " REPLICATOR_DEV_MODULE);

View File

@ -607,10 +607,9 @@ int init_multiple_segtypes(struct cmd_context *cmd, struct segtype_library *segl
segtype->flags |= SEG_MONITORED; segtype->flags |= SEG_MONITORED;
# endif /* DMEVENTD */ # endif /* DMEVENTD */
#endif #endif
if (!lvm_register_segtype(seglib, segtype)) { if (!lvm_register_segtype(seglib, segtype))
dm_free(segtype); /* segtype is already destroyed */
return_0; return_0;
}
log_very_verbose("Initialised segtype: %s", segtype->name); log_very_verbose("Initialised segtype: %s", segtype->name);
} }