summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/posixmodule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 7286445..2afd5a6 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -6193,8 +6193,10 @@ posix_unsetenv(PyObject *self, PyObject *args)
s1 = PyBytes_AsString(os1);
err = unsetenv(s1);
- if (err)
+ if (err) {
+ Py_DECREF(s1);
return posix_error();
+ }
/* Remove the key from posix_putenv_garbage;
* this will cause it to be collected. This has to