]> sourceware.org Git - lvm2.git/commitdiff
segtype: no libmem pool usage for name allocation
authorZdenek Kabelac <zkabelac@redhat.com>
Tue, 13 Feb 2018 18:06:35 +0000 (19:06 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Tue, 13 Feb 2018 18:11:28 +0000 (19:11 +0100)
Allocate name with plain malloc & free.

lib/unknown/unknown.c

index 68d11c325c9d6694a3cf5bc2884aa175ca889bb1..8f6083a95fdd1cda392f12fb9af50a033b82c818 100644 (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)
 {
+       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);
This page took 1.202101 seconds and 5 git commands to generate.