diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2017-03-24 10:05:53 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2017-03-24 10:05:53 +0000 |
commit | 2e5664d2df02a902300f8f67b4eefe0309bde5b9 (patch) | |
tree | 0696b121ca98ddf1f011bd307040634f9464d096 /compat/imsg-buffer.c | |
parent | e87d808594e48a4c80d201d07fb86fbb9548409e (diff) | |
download | rtmux-2e5664d2df02a902300f8f67b4eefe0309bde5b9.tar.gz rtmux-2e5664d2df02a902300f8f67b4eefe0309bde5b9.tar.bz2 rtmux-2e5664d2df02a902300f8f67b4eefe0309bde5b9.zip |
Update imsg*.[ch] from OpenBSD, add some compat bits it needs and remove some
bits it doesn't.
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); } |