From fe66c2735d5bf29c1d322cce8f2a79170ba90477 Mon Sep 17 00:00:00 2001 From: fcambus Date: Fri, 16 Feb 2018 14:42:29 +0000 Subject: [PATCH] Add sizes for free() in the i386 version of the Enhanced SpeedStep driver. It was already done on amd64, but not on i386. Tested on an Atom N270. OK mpi@ --- sys/arch/i386/i386/est.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/arch/i386/i386/est.c b/sys/arch/i386/i386/est.c index 39dc5606591..e1fab1059c0 100644 --- a/sys/arch/i386/i386/est.c +++ b/sys/arch/i386/i386/est.c @@ -1,4 +1,4 @@ -/* $OpenBSD: est.c,v 1.48 2016/03/07 05:32:46 naddy Exp $ */ +/* $OpenBSD: est.c,v 1.49 2018/02/16 14:42:29 fcambus Exp $ */ /* * Copyright (c) 2003 Michael Eriksson. * All rights reserved. @@ -1036,7 +1036,7 @@ est_acpi_pss_changed(struct acpicpu_pss *pss, int npss) needtran = 0; } - free(est_fqlist->table, M_DEVBUF, 0); + free(est_fqlist->table, M_DEVBUF, npss * sizeof(struct est_op)); free(est_fqlist, M_DEVBUF, sizeof *est_fqlist); est_fqlist = acpilist; @@ -1141,7 +1141,7 @@ est_init(struct cpu_info *ci, int vendor) if ((fake_table = mallocarray(3, sizeof(struct est_op), M_DEVBUF, M_NOWAIT)) == NULL) { - free(fake_fqlist, M_DEVBUF, 0); + free(fake_fqlist, M_DEVBUF, sizeof(struct fqlist)); printf("%s: EST: cannot allocate memory for fake " "table\n", cpu_device); return; @@ -1206,7 +1206,7 @@ nospeedstep: * it can't fail in that case and therefore can't reach here. */ free(est_fqlist->table, M_DEVBUF, 0); - free(est_fqlist, M_DEVBUF, 0); + free(est_fqlist, M_DEVBUF, sizeof(*est_fqlist)); } void -- 2.20.1