Mercurial > cpython-lru_cache-weakref
diff Python/codecs.c @ 12048:f87b56eebacc legacy-trunk
Marc-Andre Lemburg:
Andy Robinson noted a core dump in the codecs.c file. This
was introduced by my latest patch which fixed a memory leak
in codecs.c. The bug causes all successful codec lookups to fail.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Fri, 24 Mar 2000 20:52:23 +0000 |
| parents | 7994d9db7f4d |
| children | bc861add5d71 |
line wrap: on
line diff
--- a/Python/codecs.c Fri Mar 24 20:42:39 2000 +0000 +++ b/Python/codecs.c Fri Mar 24 20:52:23 2000 +0000 @@ -93,7 +93,7 @@ PyObject *_PyCodec_Lookup(const char *encoding) { - PyObject *result, *args = NULL, *v = NULL; + PyObject *result, *args = NULL, *v; int i, len; if (_PyCodec_SearchCache == NULL || _PyCodec_SearchPath == NULL) { @@ -119,15 +119,14 @@ } /* Next, scan the search functions in order of registration */ - len = PyList_Size(_PyCodec_SearchPath); - if (len < 0) - goto onError; - args = PyTuple_New(1); if (args == NULL) goto onError; PyTuple_SET_ITEM(args,0,v); - v = NULL; + + len = PyList_Size(_PyCodec_SearchPath); + if (len < 0) + goto onError; for (i = 0; i < len; i++) { PyObject *func; @@ -135,7 +134,7 @@ func = PyList_GetItem(_PyCodec_SearchPath, i); if (func == NULL) goto onError; - result = PyEval_CallObject(func,args); + result = PyEval_CallObject(func, args); if (result == NULL) goto onError; if (result == Py_None) { @@ -163,7 +162,6 @@ return result; onError: - Py_XDECREF(v); Py_XDECREF(args); return NULL; }
