diff options
Diffstat (limited to 'compat/imsg-buffer.c')
-rw-r--r-- | compat/imsg-buffer.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compat/imsg-buffer.c b/compat/imsg-buffer.c index 4c8d5e2c..3576d5f0 100644 --- a/compat/imsg-buffer.c +++ b/compat/imsg-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg-buffer.c,v 1.7 2015/07/12 18:40:49 nicm Exp $ */ +/* $OpenBSD: imsg-buffer.c,v 1.9 2017/03/17 14:51:26 deraadt Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -78,7 +78,7 @@ ibuf_realloc(struct ibuf *buf, size_t len) return (-1); } - b = realloc(buf->buf, buf->wpos + len); + b = recallocarray(buf->buf, buf->size, buf->wpos + len, 1); if (b == NULL) return (-1); buf->buf = b; @@ -180,6 +180,8 @@ again: void ibuf_free(struct ibuf *buf) { + if (buf == NULL) + return; free(buf->buf); free(buf); } |