diff --git a/sys/dev/disk/dm/dm_ioctl.c b/sys/dev/disk/dm/dm_ioctl.c --- a/sys/dev/disk/dm/dm_ioctl.c +++ b/sys/dev/disk/dm/dm_ioctl.c @@ -1003,7 +1003,7 @@ const char *name, *uuid; uint32_t flags, minor; uint64_t table_start, table_end, sector; - char *msg; + char *msg = NULL; int ret, found = 0; flags = 0; @@ -1025,7 +1025,10 @@ } /* Get message string */ - prop_dictionary_get_cstring(dm_dict, DM_MESSAGE_STR, &msg); + if (prop_dictionary_get_cstring(dm_dict, DM_MESSAGE_STR, &msg) == false) { + dm_dev_unbusy(dmv); + return EINVAL; + } tbl = dm_table_get_entry(&dmv->table_head, DM_TABLE_ACTIVE); @@ -1055,7 +1058,8 @@ dm_table_release(&dmv->table_head, DM_TABLE_ACTIVE); - kfree(msg, M_TEMP); + if (msg != NULL) + kfree(msg, M_TEMP); dm_dev_unbusy(dmv); return ret;