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

segtype: no libmem pool usage for name allocation

Allocate name with plain malloc & free.
This commit is contained in:
Zdenek Kabelac 2018-02-13 19:06:35 +01:00
parent 32febed8d5
commit 0eb9daf602

View File

@ -49,6 +49,7 @@ static int _unknown_text_export(const struct lv_segment *seg, struct formatter *
static void _unknown_destroy(struct segment_type *segtype) static void _unknown_destroy(struct segment_type *segtype)
{ {
dm_free(segtype->name);
dm_free(segtype); dm_free(segtype);
} }
@ -68,7 +69,12 @@ struct segment_type *init_unknown_segtype(struct cmd_context *cmd, const char *n
} }
segtype->ops = &_unknown_ops; segtype->ops = &_unknown_ops;
segtype->name = dm_pool_strdup(cmd->libmem, name); if (!(segtype->name = dm_strdup(name))) {
log_error("Failed to allocate name.");
dm_free(segtype);
return NULL;
}
segtype->flags = SEG_UNKNOWN | SEG_VIRTUAL | SEG_CANNOT_BE_ZEROED; segtype->flags = SEG_UNKNOWN | SEG_VIRTUAL | SEG_CANNOT_BE_ZEROED;
log_very_verbose("Initialised segtype: %s", segtype->name); log_very_verbose("Initialised segtype: %s", segtype->name);