]> granicus.if.org Git - python/commitdiff
Issue #15868: Fix refleak in bytesio.c (Coverity #715365).
authorStefan Krah <skrah@bytereef.org>
Sat, 8 Sep 2012 09:12:33 +0000 (11:12 +0200)
committerStefan Krah <skrah@bytereef.org>
Sat, 8 Sep 2012 09:12:33 +0000 (11:12 +0200)
Modules/_io/bytesio.c

index ef951aaa031e31e711388c71dfe73aaefbdb1a21..41645334075770c93ac3e4ba40b180b7c34ab203 100644 (file)
@@ -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);