Diff between 4dc3fd37f76f27b81652c28c87ae0a1958533c23 and ed5ee4d4c3444cbf51ea84a13d484629d3795186

Changed Files

File Additions Deletions Status
src/shared/shell.c +6 -0 modified

Full Patch

diff --git a/src/shared/shell.c b/src/shared/shell.c
index b503c66..367e255 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -1145,6 +1145,8 @@ void bt_shell_set_env(const char *name, void *value)
 	struct bt_shell_env *env;
 
 	if (!data.envs) {
+		if (!value)
+			return;
 		data.envs = queue_new();
 		goto done;
 	}
@@ -1153,6 +1155,10 @@ void bt_shell_set_env(const char *name, void *value)
 	if (env)
 		env_destroy(env);
 
+	/* Don't create an env if value is not set */
+	if (!value)
+		return;
+
 done:
 	env = new0(struct bt_shell_env, 1);
 	env->name = strdup(name);