From: milesp20 Date: Tue, 8 May 2018 02:08:42 +0000 (-0400) Subject: Update nuc_led.c X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1ee419dd154a8e99007de5e740f8b4c181c903ec;p=intel_nuc_led Update nuc_led.c fix memory leak when parsing input params --- diff --git a/nuc_led.c b/nuc_led.c index 36cf9ce..c975f22 100644 --- a/nuc_led.c +++ b/nuc_led.c @@ -225,7 +225,7 @@ static ssize_t acpi_proc_write(struct file *filp, const char __user *buff, { int i = 0; int ret = 0; - char *input, *arg; + char *input, *arg, *sep; static int status = 0; struct led_set_state_return retval; u32 led, brightness, blink_fade, color_state; @@ -244,7 +244,8 @@ static ssize_t acpi_proc_write(struct file *filp, const char __user *buff, input[len - 1] = '\0'; // Parse input string - while ((arg = strsep(&input, ",")) && *arg) + sep = input; + while ((arg = strsep(&sep, ",")) && *arg) { if (i == 0) // First arg: LED ("power" or "ring") {