From 78689b156feeda17c249b27015d074869d2d25c5 Mon Sep 17 00:00:00 2001 From: Maxime Henrion Date: Wed, 24 Apr 2002 17:49:21 +0000 Subject: [PATCH] Don't call freeenv() on a modified pointer. Submitted by: Alexander Kabaev Reviewed by: phk Pointy hat to: mux --- sys/dev/acpica/acpi.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 6c81159e4540..90c712449560 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -1590,17 +1590,18 @@ acpi_avoid(ACPI_HANDLE handle) int acpi_disabled(char *subsys) { - char *cp; + char *cp, *env; int len; - if ((cp = getenv("debug.acpi.disable")) == NULL) + if ((env = getenv("debug.acpi.disable")) == NULL) return(0); - if (!strcmp(cp, "all")) { - freeenv(cp); + if (!strcmp(env, "all")) { + freeenv(env); return(1); } /* scan the disable list checking for a match */ + cp = env; for (;;) { while ((*cp != 0) && isspace(*cp)) cp++; @@ -1610,12 +1611,12 @@ acpi_disabled(char *subsys) while ((cp[len] != 0) && !isspace(cp[len])) len++; if (!strncmp(cp, subsys, len)) { - freeenv(cp); + freeenv(env); return(1); } cp += len; } - freeenv(cp); + freeenv(env); return(0); }