From d41987d77c903e00cca7bcf3e04ed07151e3bb4d Mon Sep 17 00:00:00 2001 From: Paulo Zanoni Date: Tue, 1 Nov 2011 10:42:36 -0200 Subject: parser: free val.str after xf86getBoolValue After we convert the value to a boolean, we discard the string. This is just one example: 3 bytes in 1 blocks are definitely lost in loss record 5 of 657 at 0x4C2779D: malloc (vgpreload_memcheck-amd64-linux.so) by 0x4D744D: xf86getToken (scan.c:400) by 0x4D75F1: xf86getSubToken (scan.c:462) by 0x4DB3E0: xf86parseInputClassSection (InputClass.c:189) by 0x4D664C: xf86readConfigFile (read.c:184) by 0x490556: xf86HandleConfigFile (xf86Config.c:2360) by 0x49AA77: InitOutput (xf86Init.c:365) by 0x425A7A: main (main.c:204) Signed-off-by: Paulo Zanoni Reviewed-by: Peter Hutterer Reviewed-by: Dan Nicholson --- hw/xfree86/parser/InputClass.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/xfree86/parser/InputClass.c b/hw/xfree86/parser/InputClass.c index 3f801700e..11289959f 100644 --- a/hw/xfree86/parser/InputClass.c +++ b/hw/xfree86/parser/InputClass.c @@ -182,6 +182,7 @@ xf86parseInputClassSection(void) Error(QUOTE_MSG, "MatchIsKeyboard"); ptr->is_keyboard.set = xf86getBoolValue(&ptr->is_keyboard.val, val.str); + free(val.str); if (!ptr->is_keyboard.set) Error(BOOL_MSG, "MatchIsKeyboard"); break; @@ -190,6 +191,7 @@ xf86parseInputClassSection(void) Error(QUOTE_MSG, "MatchIsPointer"); ptr->is_pointer.set = xf86getBoolValue(&ptr->is_pointer.val, val.str); + free(val.str); if (!ptr->is_pointer.set) Error(BOOL_MSG, "MatchIsPointer"); break; @@ -198,6 +200,7 @@ xf86parseInputClassSection(void) Error(QUOTE_MSG, "MatchIsJoystick"); ptr->is_joystick.set = xf86getBoolValue(&ptr->is_joystick.val, val.str); + free(val.str); if (!ptr->is_joystick.set) Error(BOOL_MSG, "MatchIsJoystick"); break; @@ -206,6 +209,7 @@ xf86parseInputClassSection(void) Error(QUOTE_MSG, "MatchIsTablet"); ptr->is_tablet.set = xf86getBoolValue(&ptr->is_tablet.val, val.str); + free(val.str); if (!ptr->is_tablet.set) Error(BOOL_MSG, "MatchIsTablet"); break; @@ -214,6 +218,7 @@ xf86parseInputClassSection(void) Error(QUOTE_MSG, "MatchIsTouchpad"); ptr->is_touchpad.set = xf86getBoolValue(&ptr->is_touchpad.val, val.str); + free(val.str); if (!ptr->is_touchpad.set) Error(BOOL_MSG, "MatchIsTouchpad"); break; @@ -222,6 +227,7 @@ xf86parseInputClassSection(void) Error(QUOTE_MSG, "MatchIsTouchscreen"); ptr->is_touchscreen.set = xf86getBoolValue(&ptr->is_touchscreen.val, val.str); + free(val.str); if (!ptr->is_touchscreen.set) Error(BOOL_MSG, "MatchIsTouchscreen"); break; -- cgit v1.2.3