From bae2bd509caafb58e32eb30678e33df546f85cbd Mon Sep 17 00:00:00 2001 From: deraadt Date: Fri, 28 Aug 2015 00:03:53 +0000 Subject: fairly simple sizes for free(); ok tedu --- sys/crypto/crypto.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'sys/crypto/crypto.c') diff --git a/sys/crypto/crypto.c b/sys/crypto/crypto.c index 8ab5563e9a9..1222d21604a 100644 --- a/sys/crypto/crypto.c +++ b/sys/crypto/crypto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto.c,v 1.74 2015/02/09 03:15:41 dlg Exp $ */ +/* $OpenBSD: crypto.c,v 1.75 2015/08/28 00:03:53 deraadt Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) * @@ -260,9 +260,11 @@ crypto_get_driverid(u_int8_t flags) newdrv[i].cc_sessions = 1; /* Mark */ newdrv[i].cc_flags = flags; - crypto_drivers_num *= 2; - free(crypto_drivers, M_CRYPTO_DATA, 0); + free(crypto_drivers, M_CRYPTO_DATA, + crypto_drivers_num * sizeof(struct cryptocap)); + + crypto_drivers_num *= 2; crypto_drivers = newdrv; splx(s); return i; -- cgit v1.2.3-59-g8ed1b