From 33283ba3009ae1f67a73a0a6113d449ef11d039f Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 15 Jul 2013 17:47:39 +0200 Subject: Issue #18408: Fix CJK decoders, raise MemoryError on memory allocation failure --- Modules/cjkcodecs/multibytecodec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c index b449953..2a29b7d 100644 --- a/Modules/cjkcodecs/multibytecodec.c +++ b/Modules/cjkcodecs/multibytecodec.c @@ -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; -- cgit v0.12