[PATCH 5/5] parser: free val.str after xstrtokenize
przanoni at gmail.com
przanoni at gmail.com
Tue Nov 1 06:12:38 PDT 2011
From: Paulo Zanoni <paulo.r.zanoni at intel.com>
After we tokenize val.str, we discard it.
This is just one example:
6 bytes in 1 blocks are definitely lost in loss record 24 of 652
at 0x4C2779D: malloc (in vgpreload_memcheck-amd64-linux.so)
by 0x4D744D: xf86getToken (scan.c:400)
by 0x4D75F1: xf86getSubToken (scan.c:462)
by 0x4DB060: xf86parseInputClassSection (InputClass.c:145)
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 | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/hw/xfree86/parser/InputClass.c b/hw/xfree86/parser/InputClass.c
index 1128995..2cdc912 100644
--- a/hw/xfree86/parser/InputClass.c
+++ b/hw/xfree86/parser/InputClass.c
@@ -128,54 +128,63 @@ xf86parseInputClassSection(void)
Error(QUOTE_MSG, "MatchProduct");
add_group_entry(&ptr->match_product,
xstrtokenize(val.str, TOKEN_SEP));
+ free(val.str);
break;
case MATCH_VENDOR:
if (xf86getSubToken(&(ptr->comment)) != STRING)
Error(QUOTE_MSG, "MatchVendor");
add_group_entry(&ptr->match_vendor,
xstrtokenize(val.str, TOKEN_SEP));
+ free(val.str);
break;
case MATCH_DEVICE_PATH:
if (xf86getSubToken(&(ptr->comment)) != STRING)
Error(QUOTE_MSG, "MatchDevicePath");
add_group_entry(&ptr->match_device,
xstrtokenize(val.str, TOKEN_SEP));
+ free(val.str);
break;
case MATCH_OS:
if (xf86getSubToken(&(ptr->comment)) != STRING)
Error(QUOTE_MSG, "MatchOS");
add_group_entry(&ptr->match_os,
xstrtokenize(val.str, TOKEN_SEP));
+ free(val.str);
break;
case MATCH_PNPID:
if (xf86getSubToken(&(ptr->comment)) != STRING)
Error(QUOTE_MSG, "MatchPnPID");
add_group_entry(&ptr->match_pnpid,
xstrtokenize(val.str, TOKEN_SEP));
+ free(val.str);
break;
case MATCH_USBID:
if (xf86getSubToken(&(ptr->comment)) != STRING)
Error(QUOTE_MSG, "MatchUSBID");
add_group_entry(&ptr->match_usbid,
xstrtokenize(val.str, TOKEN_SEP));
+ free(val.str);
break;
case MATCH_DRIVER:
if (xf86getSubToken(&(ptr->comment)) != STRING)
Error(QUOTE_MSG, "MatchDriver");
add_group_entry(&ptr->match_driver,
xstrtokenize(val.str, TOKEN_SEP));
+ free(val.str);
break;
case MATCH_TAG:
if (xf86getSubToken(&(ptr->comment)) != STRING)
Error(QUOTE_MSG, "MatchTag");
add_group_entry(&ptr->match_tag,
xstrtokenize(val.str, TOKEN_SEP));
+ free(val.str);
break;
case MATCH_LAYOUT:
if (xf86getSubToken(&(ptr->comment)) != STRING)
Error(QUOTE_MSG, "MatchLayout");
add_group_entry(&ptr->match_layout,
xstrtokenize(val.str, TOKEN_SEP));
+ free(val.str);
break;
case MATCH_IS_KEYBOARD:
if (xf86getSubToken(&(ptr->comment)) != STRING)
--
1.7.7
More information about the xorg-devel
mailing list