From 0eb9daf602281d233c83e5823b3c6297fb541deb Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Tue, 13 Feb 2018 19:06:35 +0100 Subject: [PATCH] segtype: no libmem pool usage for name allocation Allocate name with plain malloc & free. --- lib/unknown/unknown.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/unknown/unknown.c b/lib/unknown/unknown.c index 68d11c325..8f6083a95 100644 --- a/lib/unknown/unknown.c +++ b/lib/unknown/unknown.c @@ -49,6 +49,7 @@ static int _unknown_text_export(const struct lv_segment *seg, struct formatter * static void _unknown_destroy(struct segment_type *segtype) { + dm_free(segtype->name); 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->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; log_very_verbose("Initialised segtype: %s", segtype->name);