diff --git a/common/cli.c b/common/cli.c
index fbcd339c9beeb2998c68876f942811426c060682..119d282bc240d82ba4cfcc050c1cb5c118709cb1 100644
--- a/common/cli.c
+++ b/common/cli.c
@@ -103,9 +103,9 @@ int run_command_list(const char *cmd, int len, int flag)
 	 * is pretty rare.
 	 */
 	rcode = cli_simple_run_command_list(buff, flag);
+#endif
 	if (need_buff)
 		free(buff);
-#endif
 
 	return rcode;
 }