From 313a9f9dbc17a99d90b74769f13b57c403262d04 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Mon, 12 Jun 2017 13:45:40 +0000 Subject: specify free() size from the old allocation, not new allocation. fix from C Turt --- sys/dev/wscons/wsmux.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys/dev/wscons') diff --git a/sys/dev/wscons/wsmux.c b/sys/dev/wscons/wsmux.c index 90c7b20d3a6..c8654dc01e1 100644 --- a/sys/dev/wscons/wsmux.c +++ b/sys/dev/wscons/wsmux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsmux.c,v 1.31 2015/09/10 18:14:52 mpi Exp $ */ +/* $OpenBSD: wsmux.c,v 1.32 2017/06/12 13:45:39 deraadt Exp $ */ /* $NetBSD: wsmux.c,v 1.37 2005/04/30 03:47:12 augustss Exp $ */ /* @@ -142,10 +142,10 @@ wsmux_getmux(int n) bcopy(old, new, nwsmux * sizeof(*wsmuxdevs)); for (i = nwsmux; i < (n + 1); i++) new[i] = NULL; - wsmuxdevs = new; - nwsmux = n + 1; if (old != NULL) free(old, M_DEVBUF, nwsmux * sizeof(*wsmuxdevs)); + wsmuxdevs = new; + nwsmux = n + 1; } sc = wsmuxdevs[n]; -- cgit v1.2.3