From 56bd49a9467056355ad3e8a441a3dd626e0ea57c Mon Sep 17 00:00:00 2001 From: deraadt Date: Mon, 12 Jun 2017 13:45:39 +0000 Subject: [PATCH] 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(-) 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]; -- 2.20.1