summaryrefslogtreecommitdiffstats
path: root/newlib/libc/stdlib/getenv_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdlib/getenv_r.c')
-rw-r--r--newlib/libc/stdlib/getenv_r.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/newlib/libc/stdlib/getenv_r.c b/newlib/libc/stdlib/getenv_r.c
index 4d567c718..2cc48cfd7 100644
--- a/newlib/libc/stdlib/getenv_r.c
+++ b/newlib/libc/stdlib/getenv_r.c
@@ -94,7 +94,10 @@ _DEFUN (_findenv_r, (reent_ptr, name, offset),
/* In some embedded systems, this does not get set. This protects
newlib from dereferencing a bad pointer. */
if (!*p_environ)
- return NULL;
+ {
+ ENV_UNLOCK;
+ return NULL;
+ }
c = name;
len = 0;