summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Krah <skrah@bytereef.org>2012-09-08 09:12:33 (GMT)
committerStefan Krah <skrah@bytereef.org>2012-09-08 09:12:33 (GMT)
commit96efdd422cef75f70770107847b1a97e7e524e4c (patch)
treef61600d04324ecb416d11a07b581c6dc15af2814
parent7ff1822ec729fc389786683af886ea2f2b13cfbf (diff)
downloadcpython-96efdd422cef75f70770107847b1a97e7e524e4c.zip
cpython-96efdd422cef75f70770107847b1a97e7e524e4c.tar.gz
cpython-96efdd422cef75f70770107847b1a97e7e524e4c.tar.bz2
Issue #15868: Fix refleak in bytesio.c (Coverity #715365).
-rw-r--r--Modules/_io/bytesio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_io/bytesio.c b/Modules/_io/bytesio.c
index ef951aa..4164533 100644
--- a/Modules/_io/bytesio.c
+++ b/Modules/_io/bytesio.c
@@ -692,8 +692,10 @@ bytesio_getstate(bytesio *self)
}
else {
dict = PyDict_Copy(self->dict);
- if (dict == NULL)
+ if (dict == NULL) {
+ Py_DECREF(initvalue);
return NULL;
+ }
}
state = Py_BuildValue("(OnN)", initvalue, self->pos, dict);