diff --git a/tools/dmsetup.c b/tools/dmsetup.c index 4025acc37..d6d9dcfed 100644 --- a/tools/dmsetup.c +++ b/tools/dmsetup.c @@ -3654,11 +3654,10 @@ static int _process_switches(int *argc, char ***argv, const char *dev_dir) _switches[SHOWKEYS_ARG]++; if (ind == TABLE_ARG) { _switches[TABLE_ARG]++; - if (!(_table = dm_malloc(strlen(optarg + 1)))) { + if (!(_table = dm_strdup(optarg))) { log_error("Could not allocate memory for table string."); return 0; } - strcpy(_table, optarg); } if (ind == TREE_ARG) _switches[TREE_ARG]++;