[PATCH 4/5] parser: free val.str after xf86getBoolValue

przanoni at gmail.com przanoni at gmail.com
Tue Nov 1 06:12:37 PDT 2011


From: Paulo Zanoni <paulo.r.zanoni at intel.com>

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 <paulo.r.zanoni at intel.com>
---
 hw/xfree86/parser/InputClass.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/hw/xfree86/parser/InputClass.c b/hw/xfree86/parser/InputClass.c
index 3f80170..1128995 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;
-- 
1.7.7



More information about the xorg-devel mailing list