Fix uninitialized variable access, release memory.

This commit is contained in:
Martin v. Löwis 2008-06-02 12:33:47 +00:00
parent 704d8b154b
commit 7cd068baab
1 changed files with 3 additions and 0 deletions

View File

@ -732,6 +732,7 @@ initstdio(void)
}
encoding = Py_GETENV("PYTHONIOENCODING");
errors = NULL;
if (encoding) {
encoding = strdup(encoding);
errors = strchr(encoding, ':');
@ -825,6 +826,8 @@ initstdio(void)
status = -1;
}
if (encoding)
free(encoding);
Py_XDECREF(bimod);
Py_XDECREF(iomod);
return status;