Diff between 4ed860a45246e362c3030f1e02613b92d332c133 and 1e5f903205905fe7ebce897d1b7e6f5e8ab591f6

Changed Files

File Additions Deletions Status
src/shared/shell.c +3 -1 modified

Full Patch

diff --git a/src/shared/shell.c b/src/shared/shell.c
index 6e6648c..709d205 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -573,10 +573,12 @@ void bt_shell_prompt_input(const char *label, const char *msg,
 	if (data.saved_prompt)
 		return;
 
+	if (asprintf(&str, "[%s] %s ", label, msg) < 0)
+		return;
+
 	data.saved_prompt = true;
 	data.saved_func = func;
 	data.saved_user_data = user_data;
-	asprintf(&str, "[%s] %s ", label, msg);
 
 	rl_save_prompt();
 	bt_shell_set_prompt(str);