From 2e5664d2df02a902300f8f67b4eefe0309bde5b9 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Fri, 24 Mar 2017 10:05:53 +0000 Subject: Update imsg*.[ch] from OpenBSD, add some compat bits it needs and remove some bits it doesn't. --- compat/imsg-buffer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'compat/imsg-buffer.c') 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 @@ -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); } -- cgit