From 9edcc2e2fd6196886f9e94407833f14c2a854c22 Mon Sep 17 00:00:00 2001 From: Neal Norwitz Date: Sat, 11 Aug 2007 04:58:26 +0000 Subject: Handle error --- Python/codecs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Python/codecs.c') diff --git a/Python/codecs.c b/Python/codecs.c index 3aa1f386e7b..464fffc1507 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; -- cgit v1.2.3