Skip to content

Commit 1979722

Browse files
authored
Raise MemoryError when failed to grow buffer (#263)
1 parent 43137d6 commit 1979722

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

msgpack/pack.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ static inline int msgpack_pack_write(msgpack_packer* pk, const char *data, size_
4848
if (len + l > bs) {
4949
bs = (len + l) * 2;
5050
buf = (char*)PyMem_Realloc(buf, bs);
51-
if (!buf) return -1;
51+
if (!buf) {
52+
PyErr_NoMemory();
53+
return -1;
54+
}
5255
}
5356
memcpy(buf + len, data, l);
5457
len += l;

0 commit comments

Comments
 (0)