From e7bf0e03d29edbe962e0d432e71884d291a3d93b Mon Sep 17 00:00:00 2001
From: David Sidrane <david_s5@nscdg.com>
Date: Fri, 7 Dec 2018 12:59:07 -0800
Subject: [PATCH] px4_nuttx_tasks:Support future removal of env.

   CONFIG_DISABLE_ENVIRON can prevent task having to allocate
   memory for the env.
---
 platforms/nuttx/src/px4_layer/px4_nuttx_tasks.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/platforms/nuttx/src/px4_layer/px4_nuttx_tasks.c b/platforms/nuttx/src/px4_layer/px4_nuttx_tasks.c
index 1f149d1a09..196ccbe0b7 100644
--- a/platforms/nuttx/src/px4_layer/px4_nuttx_tasks.c
+++ b/platforms/nuttx/src/px4_layer/px4_nuttx_tasks.c
@@ -71,14 +71,14 @@ int px4_task_spawn_cmd(const char *name, int scheduler, int priority, int stack_
 	int pid;
 
 	sched_lock();
-
+#if !defined(CONFIG_DISABLE_ENVIRON)
 	/* None of the modules access the environment variables (via getenv() for instance), so delete them
 	 * all. They are only used within the startup script, and NuttX automatically exports them to the children
 	 * tasks.
 	 * This frees up a considerable amount of RAM.
 	 */
 	clearenv();
-
+#endif
 	/* create the task */
 	pid = task_create(name, priority, stack_size, entry, argv);
 
-- 
GitLab