diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c index aab6305c3..fb2fdd117 100644 --- a/libdm/ioctl/libdm-iface.c +++ b/libdm/ioctl/libdm-iface.c @@ -852,7 +852,7 @@ int dm_task_set_event_nr(struct dm_task *dmt, uint32_t event_nr) struct target *create_target(uint64_t start, uint64_t len, const char *type, const char *params) { - struct target *t = dm_malloc(sizeof(*t)); + struct target *t = dm_zalloc(sizeof(*t)); if (!t) { log_error("create_target: malloc(%" PRIsize_t ") failed", @@ -860,8 +860,6 @@ struct target *create_target(uint64_t start, uint64_t len, const char *type, return NULL; } - memset(t, 0, sizeof(*t)); - if (!(t->params = dm_strdup(params))) { log_error("create_target: strdup(params) failed"); goto bad;