comparison Python/pythonrun.c @ 74496:93e86b9318f7 3.2

Fix a memory leak when initializing the standard I/O streams.
author Antoine Pitrou <solipsis@pitrou.net>
date Wed, 18 Jan 2012 15:14:46 +0100
parents f15943505db0
children 4a31f6b11e7a a321ffb21367
comparison
equal deleted inserted replaced
74493:7d405058e458 74496:93e86b9318f7
1010 encoding_attr = PyObject_GetAttrString(std, "encoding"); 1010 encoding_attr = PyObject_GetAttrString(std, "encoding");
1011 if (encoding_attr != NULL) { 1011 if (encoding_attr != NULL) {
1012 const char * encoding; 1012 const char * encoding;
1013 encoding = _PyUnicode_AsString(encoding_attr); 1013 encoding = _PyUnicode_AsString(encoding_attr);
1014 if (encoding != NULL) { 1014 if (encoding != NULL) {
1015 _PyCodec_Lookup(encoding); 1015 PyObject *codec_info = _PyCodec_Lookup(encoding);
1016 Py_XDECREF(codec_info);
1016 } 1017 }
1017 Py_DECREF(encoding_attr); 1018 Py_DECREF(encoding_attr);
1018 } 1019 }
1019 PyErr_Clear(); /* Not a fatal error if codec isn't available */ 1020 PyErr_Clear(); /* Not a fatal error if codec isn't available */
1020 1021