summaryrefslogtreecommitdiff
path: root/Python/codecs.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-12-11 08:38:03 +0200
committerGitHub <noreply@github.com>2018-12-11 08:38:03 +0200
commit8905fcc85a6fc3ac394bc89b0bbf40897e9497a6 (patch)
tree5b7afcdceab6dae37e3db90f952c5c76fe46b5cf /Python/codecs.c
parentbb86bf4c4eaa30b1f5192dab9f389ce0bb61114d (diff)
downloadcpython-git-8905fcc85a6fc3ac394bc89b0bbf40897e9497a6.tar.gz
bpo-35454: Fix miscellaneous minor issues in error handling. (#11077)
* bpo-35454: Fix miscellaneous minor issues in error handling. * Fix a null pointer dereference.
Diffstat (limited to 'Python/codecs.c')
-rw-r--r--Python/codecs.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/codecs.c b/Python/codecs.c
index 002fad3080..ff2142df40 100644
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -129,8 +129,10 @@ PyObject *_PyCodec_Lookup(const char *encoding)
/* Next, scan the search functions in order of registration */
args = PyTuple_New(1);
- if (args == NULL)
- goto onError;
+ if (args == NULL) {
+ Py_DECREF(v);
+ return NULL;
+ }
PyTuple_SET_ITEM(args,0,v);
len = PyList_Size(interp->codec_search_path);