diff --git a/cli-authinteract.c b/cli-authinteract.c
index 5a169cb2e90895a5c5dcb1af544abf9e4e75a90c..5fe5bf164dbc931d736f0c32ae3c02e0348a87bf 100644
--- a/cli-authinteract.c
+++ b/cli-authinteract.c
@@ -99,13 +99,14 @@ void recv_msg_userauth_info_request() {
 	if (strlen(name) > 0) {
 		cleantext(name);
 		fprintf(stderr, "%s", name);
-		m_free(name);
 	}
+	m_free(name);
+
 	if (strlen(instruction) > 0) {
 		cleantext(instruction);
 		fprintf(stderr, "%s", instruction);
-		m_free(instruction);
 	}
+	m_free(instruction);
 
 	for (i = 0; i < num_prompts; i++) {
 		unsigned int response_len = 0;