diff --git a/docs/changes.txt b/docs/changes.txt
index f58707fd5..7ba88d25a 100644
--- a/docs/changes.txt
+++ b/docs/changes.txt
@@ -49,6 +49,7 @@
 - Fixed race condition resulting in out of memory error on startup if multiple hashcat instances are started at the same time
 - Fixed rare case of misalignment of the status prompt when other user warnings are shown within the hashcat output
 - Fixed too early execution of some module functions which could make use of non-final values opts_type and opti_type
+- Fixed tuning database search if a device was not assigned an alias it couldn't be found in general
 - Fixed unexpected non-unique salts in multi-hash cracking in Bitcoin/Litecoin wallet.dat module which lead to false negatives
 
 ##
diff --git a/src/tuningdb.c b/src/tuningdb.c
index cfdb70a86..eae22ed1e 100644
--- a/src/tuningdb.c
+++ b/src/tuningdb.c
@@ -337,15 +337,17 @@ tuning_db_entry_t *tuning_db_search_real (hashcat_ctx_t *hashcat_ctx, const char
 
   // find out if there's an alias configured
 
+  char *device_name_nospace2 = hcstrdup (device_name_nospace);
+
   tuning_db_alias_t a;
 
-  a.device_name = device_name_nospace;
+  a.device_name = device_name_nospace2;
 
   char *alias_name = NULL;
 
   for (i = device_name_length; i >= 1; i--)
   {
-    device_name_nospace[i] = 0;
+    device_name_nospace2[i] = 0;
 
     tuning_db_alias_t *alias = (tuning_db_alias_t *) bsearch (&a, tuning_db->alias_buf, tuning_db->alias_cnt, sizeof (tuning_db_alias_t), sort_by_tuning_db_alias);
 
@@ -356,6 +358,8 @@ tuning_db_entry_t *tuning_db_search_real (hashcat_ctx_t *hashcat_ctx, const char
     break;
   }
 
+  hcfree (device_name_nospace2);
+
   // attack-mode 6 and 7 are attack-mode 1 basically
 
   if (attack_mode == 6) attack_mode = 1;