diff --git a/cli.c b/cli.c
index fa33bcc33cd802b4c9403741a635f1b565cdef88..e5fc6612093826884f23b21491aa40b9d6754608 100755
--- a/cli.c
+++ b/cli.c
@@ -873,7 +873,7 @@ static char *__ast_cli_generator(char *text, char *word, int state, int lock)
 						if (lock)
 							ast_pthread_mutex_unlock(&clilock);
 						free(dup);
-						return res ? res : NULL;
+						return res ? strdup(res) : NULL;
 					}
 				}
 			}