Ian Campbell
2010-Aug-03 10:21 UTC
[Xen-devel] [PATCH] libxl: free values in XLU_ConfigSetting
# HG changeset patch # User Ian Campbell <ian.campbell@citrix.com> # Date 1280829528 -3600 # Node ID b2ed7cc08554cba162f93cb95e84c2130d76b314 # Parent 8cd4de118ca4d0124011bff1611ddc2e04bd6566 libxl: free values in XLU_ConfigSetting. Fixes these valgrind reported leaks, found with "valgrind xl create -n ..." ==21170== 8 bytes in 3 blocks are definitely lost in loss record 1 of 3 ==21170== at 0x4022F0A: malloc (vg_replace_malloc.c:236) ==21170== by 0x411B22F: strdup (in /lib/i686/cmov/libc-2.7.so) ==21170== by 0x4030085: xlu__cfgl_strdup (libxlu_cfg.c:290) ==21170== by 0x402F3C4: xlu__cfg_yylex (libxlu_cfg_l.l:37) ==21170== by 0x402DD86: xlu__cfg_yyparse (libxlu_cfg_y.c:1338) ==21170== by 0x40308AE: xlu_cfg_readdata (libxlu_cfg.c:85) ==21170== by 0x804DBE4: parse_config_data (xl_cmdimpl.c:591) ==21170== by 0x8056EE4: create_domain (xl_cmdimpl.c:1381) ==21170== by 0x80582AE: main_create (xl_cmdimpl.c:3178) ==21170== by 0x804B54B: main (xl.c:76) ==21170===21170== 57 bytes in 2 blocks are definitely lost in loss record 2 of 3 ==21170== at 0x4022F0A: malloc (vg_replace_malloc.c:236) ==21170== by 0x402FE22: xlu__cfgl_dequote (libxlu_cfg.c:307) ==21170== by 0x402F4B4: xlu__cfg_yylex (libxlu_cfg_l.l:52) ==21170== by 0x402DD86: xlu__cfg_yyparse (libxlu_cfg_y.c:1338) ==21170== by 0x40308AE: xlu_cfg_readdata (libxlu_cfg.c:85) ==21170== by 0x804DBE4: parse_config_data (xl_cmdimpl.c:591) ==21170== by 0x8056EE4: create_domain (xl_cmdimpl.c:1381) ==21170== by 0x80582AE: main_create (xl_cmdimpl.c:3178) ==21170== by 0x804B54B: main (xl.c:76) ==21170===21170== 111 bytes in 6 blocks are definitely lost in loss record 3 of 3 ==21170== at 0x4022F0A: malloc (vg_replace_malloc.c:236) ==21170== by 0x402FE22: xlu__cfgl_dequote (libxlu_cfg.c:307) ==21170== by 0x402F4ED: xlu__cfg_yylex (libxlu_cfg_l.l:56) ==21170== by 0x402DD86: xlu__cfg_yyparse (libxlu_cfg_y.c:1338) ==21170== by 0x40308AE: xlu_cfg_readdata (libxlu_cfg.c:85) ==21170== by 0x804DBE4: parse_config_data (xl_cmdimpl.c:591) ==21170== by 0x8056EE4: create_domain (xl_cmdimpl.c:1381) ==21170== by 0x80582AE: main_create (xl_cmdimpl.c:3178) ==21170== by 0x804B54B: main (xl.c:76) Signed-off-by: Ian Campbell <ian.campbell@citrix.com> diff -r 8cd4de118ca4 -r b2ed7cc08554 tools/libxl/libxlu_cfg.c --- a/tools/libxl/libxlu_cfg.c Mon Aug 02 13:45:15 2010 +0100 +++ b/tools/libxl/libxlu_cfg.c Tue Aug 03 10:58:48 2010 +0100 @@ -91,7 +91,11 @@ int xlu_cfg_readdata(XLU_Config *cfg, co } void xlu__cfg_set_free(XLU_ConfigSetting *set) { + int i; + free(set->name); + for (i=0; i<set->nvalues; i++) + free(set->values[i]); free(set->values); free(set); } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com lists.xensource.com/xen-devel
Stefano Stabellini
2010-Aug-04 15:00 UTC
Re: [Xen-devel] [PATCH] libxl: free values in XLU_ConfigSetting
On Tue, 3 Aug 2010, Ian Campbell wrote:> # HG changeset patch > # User Ian Campbell <ian.campbell@citrix.com> > # Date 1280829528 -3600 > # Node ID b2ed7cc08554cba162f93cb95e84c2130d76b314 > # Parent 8cd4de118ca4d0124011bff1611ddc2e04bd6566 > libxl: free values in XLU_ConfigSetting. > > Fixes these valgrind reported leaks, found with "valgrind xl create -n ..." > > ==21170== 8 bytes in 3 blocks are definitely lost in loss record 1 of 3 > ==21170== at 0x4022F0A: malloc (vg_replace_malloc.c:236) > ==21170== by 0x411B22F: strdup (in /lib/i686/cmov/libc-2.7.so) > ==21170== by 0x4030085: xlu__cfgl_strdup (libxlu_cfg.c:290) > ==21170== by 0x402F3C4: xlu__cfg_yylex (libxlu_cfg_l.l:37) > ==21170== by 0x402DD86: xlu__cfg_yyparse (libxlu_cfg_y.c:1338) > ==21170== by 0x40308AE: xlu_cfg_readdata (libxlu_cfg.c:85) > ==21170== by 0x804DBE4: parse_config_data (xl_cmdimpl.c:591) > ==21170== by 0x8056EE4: create_domain (xl_cmdimpl.c:1381) > ==21170== by 0x80582AE: main_create (xl_cmdimpl.c:3178) > ==21170== by 0x804B54B: main (xl.c:76) > ==21170=> ==21170== 57 bytes in 2 blocks are definitely lost in loss record 2 of 3 > ==21170== at 0x4022F0A: malloc (vg_replace_malloc.c:236) > ==21170== by 0x402FE22: xlu__cfgl_dequote (libxlu_cfg.c:307) > ==21170== by 0x402F4B4: xlu__cfg_yylex (libxlu_cfg_l.l:52) > ==21170== by 0x402DD86: xlu__cfg_yyparse (libxlu_cfg_y.c:1338) > ==21170== by 0x40308AE: xlu_cfg_readdata (libxlu_cfg.c:85) > ==21170== by 0x804DBE4: parse_config_data (xl_cmdimpl.c:591) > ==21170== by 0x8056EE4: create_domain (xl_cmdimpl.c:1381) > ==21170== by 0x80582AE: main_create (xl_cmdimpl.c:3178) > ==21170== by 0x804B54B: main (xl.c:76) > ==21170=> ==21170== 111 bytes in 6 blocks are definitely lost in loss record 3 of 3 > ==21170== at 0x4022F0A: malloc (vg_replace_malloc.c:236) > ==21170== by 0x402FE22: xlu__cfgl_dequote (libxlu_cfg.c:307) > ==21170== by 0x402F4ED: xlu__cfg_yylex (libxlu_cfg_l.l:56) > ==21170== by 0x402DD86: xlu__cfg_yyparse (libxlu_cfg_y.c:1338) > ==21170== by 0x40308AE: xlu_cfg_readdata (libxlu_cfg.c:85) > ==21170== by 0x804DBE4: parse_config_data (xl_cmdimpl.c:591) > ==21170== by 0x8056EE4: create_domain (xl_cmdimpl.c:1381) > ==21170== by 0x80582AE: main_create (xl_cmdimpl.c:3178) > ==21170== by 0x804B54B: main (xl.c:76) > > Signed-off-by: Ian Campbell <ian.campbell@citrix.com> >applied, thanks _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com lists.xensource.com/xen-devel