From: Neal Norwitz Date: Sat, 11 Aug 2007 04:58:26 +0000 (+0000) Subject: Handle error X-Git-Tag: v3.0a1~455 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9edcc2e2fd6196886f9e94407833f14c2a854c22;p=python Handle error --- diff --git a/Python/codecs.c b/Python/codecs.c index 3aa1f386e7..464fffc150 100644 --- a/Python/codecs.c +++ b/Python/codecs.c @@ -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;