Handle error

This commit is contained in:
Neal Norwitz 2007-08-11 04:58:26 +00:00
parent 7378df7822
commit 9edcc2e2fd
1 changed files with 4 additions and 1 deletions

View File

@ -167,7 +167,10 @@ PyObject *_PyCodec_Lookup(const char *encoding)
}
/* Cache and return the result */
PyDict_SetItem(interp->codec_search_cache, v, result);
if (PyDict_SetItem(interp->codec_search_cache, v, result) < 0) {
Py_DECREF(result);
goto onError;
}
Py_DECREF(args);
return result;