diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-06-11 13:14:36 -0400 |
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-06-11 13:14:36 -0400 |
| commit | 96a895f26c0ea8b5cd426743dc2b8845aabaf423 (patch) | |
| tree | f5deebfd702cc23cd2b30eef6071b8f60a87d07f /src | |
| parent | be4cbd7fff973f3ec5ca123fbe057472c260c7ca (diff) | |
| download | stasis-96a895f26c0ea8b5cd426743dc2b8845aabaf423.tar.gz | |
Return when item is NULL
* Explicitly state error condition
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/core/environment.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/core/environment.c b/src/lib/core/environment.c index 4623db8..b4ab66e 100644 --- a/src/lib/core/environment.c +++ b/src/lib/core/environment.c @@ -445,9 +445,14 @@ void runtime_set(RuntimeEnv *env, const char *_key, char *_value) { */ void runtime_apply(RuntimeEnv *env) { for (size_t i = 0; i < strlist_count(env); i++) { - char **pair = split(strlist_item(env, i), "=", 1); + const char *item = strlist_item(env, i); + if (!item) { + SYSERROR("failed to read from env list"); + return; + } + char **pair = split((char *) item, "=", 1); if (!pair) { - SYSERROR("unable to allocate memory for runtime_apply"); + SYSERROR("unable to allocate memory for key/value pair"); return; } setenv(pair[0], pair[1], 1); |
