[PATCH] lib: parameter: Free previous string value in param_string_set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When the parameter has no set function the previous (saved_value) is not
freed up on completion.

Signed-off-by: Robin van der Gracht <robin@xxxxxxxxxxx>
---
 lib/parameter.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/parameter.c b/lib/parameter.c
index adc3c7cdea..fe7e7b1ba4 100644
--- a/lib/parameter.c
+++ b/lib/parameter.c
@@ -262,8 +262,10 @@ static int param_string_set(struct device_d *dev, struct param_d *p, const char
 	value_new = strim(value_new);
 	*ps->value = value_new;
 
-	if (!ps->set)
+	if (!ps->set) {
+		free(value_save);
 		return 0;
+	}
 
 	ret = ps->set(p, p->driver_priv);
 	if (ret) {
-- 
2.34.1





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux