]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #18408: Fix CJK decoders, raise MemoryError on memory allocation failure
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 15 Jul 2013 15:47:39 +0000 (17:47 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 15 Jul 2013 15:47:39 +0000 (17:47 +0200)
Modules/cjkcodecs/multibytecodec.c

index b449953bac65c3811e5db753c0e948edb0744e32..2a29b7d4cd5c1e081798ad375bb19e9ccaced198 100644 (file)
@@ -1053,8 +1053,10 @@ mbidecoder_decode(MultibyteIncrementalDecoderObject *self,
         }
         wsize = size + self->pendingsize;
         wdata = PyMem_Malloc(wsize);
-        if (wdata == NULL)
+        if (wdata == NULL) {
+            PyErr_NoMemory();
             goto errorexit;
+        }
         memcpy(wdata, self->pending, self->pendingsize);
         memcpy(wdata + self->pendingsize, data, size);
         self->pendingsize = 0;