File tree 1 file changed +5
-1
lines changed 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,8 @@ cdef class Packer(object):
46
46
def __cinit__ (self ):
47
47
cdef int buf_size = 1024 * 1024
48
48
self .pk.buf = < char * > malloc(buf_size);
49
+ if self .pk.buf == NULL :
50
+ raise MemoryError (" Unable to allocate internal buffer." )
49
51
self .pk.buf_size = buf_size
50
52
self .pk.length = 0
51
53
@@ -300,7 +302,9 @@ cdef class Unpacker(object):
300
302
new_size = buf_size* 2
301
303
buf = < char * > realloc(buf, new_size)
302
304
if buf == NULL :
303
- raise MemoryError (" Unable to enlarge internal buffer." ) # self.buf still holds old buffer and will be freed during obj destruction
305
+ # self.buf still holds old buffer and will be freed during
306
+ # obj destruction
307
+ raise MemoryError (" Unable to enlarge internal buffer." )
304
308
buf_size = new_size
305
309
306
310
memcpy(buf + tail, < char * > (_buf), _buf_len)
You can’t perform that action at this time.
0 commit comments