summaryrefslogtreecommitdiff
path: root/msgpack/pack.h
diff options
context:
space:
mode:
authorINADA Naoki <methane@users.noreply.github.com>2018-01-05 20:58:14 +0900
committerGitHub <noreply@github.com>2018-01-05 20:58:14 +0900
commit1979722ba2de84e68ae5992d33bc39461aa7b4b2 (patch)
tree7682f847f84a087dbe18bcd4d359b167b6cc17a5 /msgpack/pack.h
parent43137d6bd2cc841af775a9c8132e72d284b119e3 (diff)
downloadmsgpack-python-1979722ba2de84e68ae5992d33bc39461aa7b4b2.tar.gz
Raise MemoryError when failed to grow buffer (#263)
Diffstat (limited to 'msgpack/pack.h')
-rw-r--r--msgpack/pack.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/msgpack/pack.h b/msgpack/pack.h
index d3aeff7..3bc21ea 100644
--- a/msgpack/pack.h
+++ b/msgpack/pack.h
@@ -48,7 +48,10 @@ static inline int msgpack_pack_write(msgpack_packer* pk, const char *data, size_
if (len + l > bs) {
bs = (len + l) * 2;
buf = (char*)PyMem_Realloc(buf, bs);
- if (!buf) return -1;
+ if (!buf) {
+ PyErr_NoMemory();
+ return -1;
+ }
}
memcpy(buf + len, data, l);
len += l;