Permalink
Browse files

Failing to realloc is a failure even in production

  • Loading branch information...
tsee committed Oct 29, 2012
1 parent c675e49 commit bf1c60acabd875e5e3fd52428a288d72c1d863fe
Showing with 2 additions and 1 deletion.
  1. +2 −1 Perl/Encoder/srl_buffer.h
@@ -64,7 +64,8 @@ srl_buf_grow_nocheck(pTHX_ srl_encoder_t *enc, size_t minlen)
/* assert that Renew means GROWING the buffer */
assert(enc->buf_start + new_size > enc->buf_end);
Renew(enc->buf_start, new_size, char);
- assert(enc->buf_start != NULL);
+ if (enc->buf_start == NULL)
+ croak("Out of memory!");
enc->buf_end = (char *)(enc->buf_start + new_size);
enc->pos= enc->buf_start + pos_ofs;
assert(enc->buf_end - enc->buf_start > (ptrdiff_t)0);

0 comments on commit bf1c60a

Please sign in to comment.