Hi,

I have cleaned up a lot of the valgrind reported issues. Before applying
the patches, valgrind said the following,

[r...@gondor tests]# sh runlibcgrouptest.sh                                     
                       

Running first set of testcases
==============================
==12606== Memcheck, a memory error detector.
==12606== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==12606== Using LibVEX rev 1804, a library for dynamic binary translation.
==12606== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.       
==12606== Using valgrind-3.3.0, a dynamic binary instrumentation framework.
==12606== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.  
==12606== For more details, rerun with: -v                                 
==12606==                                                                  
C:DBG: fs_mounted as recieved from script=0                                
TEST 1:PASS : cgroup_init()                      Ret Value = 50001         
TEST 2:PASS : cgroup_attach_task()               Ret Value = 50014       
Parameter nullcgroup
TEST 3:PASS : cgroup_new_cgroup()                Ret Value = 0                  
             
TEST 4:PASS : cgroup_create_cgroup()             Ret Value = 50014              
             
TEST 5:PASS : cgroup_delete_cgroup()             Ret Value = 50014              
             
TEST 6:PASS : cgroup_create_cgroup()             Ret Value = 50014              
             
TEST 7:PASS : cgroup_delete_cgroup()             Ret Value = 50014              
             
TEST 8:PASS : cgroup_add_controller()            Ret Value = 0                  
             
TEST 9:PASS : cgroup_add_controller()            Ret Value = 0                  
             
TEST10:PASS : cgroup_add_controller()            Ret Value = 0                  
             
==12606==                                                                       
             
==12606== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 18 from 1)       
             
==12606== malloc/free: in use at exit: 389 bytes in 7 blocks.                   
             
==12606== malloc/free: 17 allocs, 10 frees, 28,197 bytes allocated.             
             
==12606== For counts of detected errors, rerun with: -v                         
             
==12606== searching for pointers to 7 not-freed blocks.                         
             
==12606== checked 6,385,392 bytes.                                              
             
==12606==                                                                       
             
==12606== 37 bytes in 6 blocks are still reachable in loss record 1 of 2        
             
==12606==    at 0x4006AEE: malloc (vg_replace_malloc.c:207)                     
             
==12606==    by 0x402FD1E: cgroup_init (api.c:576)                              
             
==12606==    by 0x8049999: test_cgroup_init(int, int) (libcgrouptest01.c:655)   
             
==12606==    by 0x804B797: main (libcgrouptest01.c:115)                         
             
==12606==                                                                       
             
==12606==                                                                       
             
==12606== 352 bytes in 1 blocks are still reachable in loss record 2 of 2       
             
==12606==    at 0x4006AEE: malloc (vg_replace_malloc.c:207)                     
             
==12606==    by 0x4C2AC78E: __fopen_internal (in /lib/libc-2.9.so)              
             
==12606==    by 0x4C2AC85B: fopen@@GLIBC_2.1 (in /lib/libc-2.9.so)              
             
==12606==    by 0x402FD75: cgroup_init (api.c:583)                              
             
==12606==    by 0x8049999: test_cgroup_init(int, int) (libcgrouptest01.c:655)   
             
==12606==    by 0x804B797: main (libcgrouptest01.c:115)                         
             
==12606==                                                                       
             
==12606== LEAK SUMMARY:                                                         
             
==12606==    definitely lost: 0 bytes in 0 blocks.                              
             
==12606==      possibly lost: 0 bytes in 0 blocks.                              
             
==12606==    still reachable: 389 bytes in 7 blocks.                            
             
==12606==         suppressed: 0 bytes in 0 blocks.                              
             

Running second set of testcases
============================== 
==12622== Memcheck, a memory error detector.
==12622== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==12622== Using LibVEX rev 1804, a library for dynamic binary translation.
==12622== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.       
==12622== Using valgrind-3.3.0, a dynamic binary instrumentation framework.
==12622== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.  
==12622== For more details, rerun with: -v                                 
==12622==                                                                  
C:DBG: fs_mounted as recieved from script=1                                
C:DBG: mountpoint1 as recieved from script=/dev/cgroup_controllers-1       
sanity check pass. cgroup                                                  
TEST 1:PASS : cgroup_attach_task()               Ret Value = 50014       
Parameter nullcgroup
TEST 2:PASS : cgroup_init()                      Ret Value = 0                  
             
TEST 3:PASS : cgroup_attach_task()               Ret Value = 0   Task found in 
group/s       
TEST 4:PASS : cgroup_attach_task_pid()           Ret Value = 50016              
             
TEST 5:PASS : cgroup_new_cgroup()                Ret Value = 0                  
             
TEST 6:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in 
filesystem   
TEST 7:PASS : cgroup_attach_task()               Ret Value = 0   Task found in 
group/s       
==12622== Conditional jump or move depends on uninitialised value(s)            
             
==12622==    at 0x40070D8: strncat (mc_replace_strmem.c:214)                    
             
==12622==    by 0x804BC92: main (libcgrouptest01.c:1271)                        
             
==12622==                                                                       
             
==12622== Conditional jump or move depends on uninitialised value(s)            
             
==12622==    at 0x4007271: strcpy (mc_replace_strmem.c:268)                     
             
==12622==    by 0x402F24B: cgroup_modify_cgroup (api.c:998)                     
             
==12622==    by 0x804BC9D: main (libcgrouptest01.c:252)                         
             
==12622==                                                                       
             
==12622== Conditional jump or move depends on uninitialised value(s)            
             
==12622==    at 0x4007285: strcpy (mc_replace_strmem.c:268)                     
             
==12622==    by 0x402F24B: cgroup_modify_cgroup (api.c:998)                     
             
==12622==    by 0x804BC9D: main (libcgrouptest01.c:252)                         
             
==12622==                                                                       
             
==12622== Conditional jump or move depends on uninitialised value(s)            
             
==12622==    at 0x8049471: _ZL14group_modifiedPci (libcgrouptest01.c:1076)      
             
==12622==    by 0x804C583: main (libcgrouptest01.c:254)                         
             
==12622==                                                                       
             
==12622== Conditional jump or move depends on uninitialised value(s)            
             
==12622==    at 0x8049479: _ZL14group_modifiedPci (libcgrouptest01.c:1076)      
             
==12622==    by 0x804C583: main (libcgrouptest01.c:254)                         
             
==12622==                                                                       
             
==12622== Conditional jump or move depends on uninitialised value(s)            
             
==12622==    at 0x4007470: strncmp (mc_replace_strmem.c:314)                    
             
==12622==    by 0x804949B: _ZL14group_modifiedPci (libcgrouptest01.c:1076)      
             
==12622==    by 0x804C583: main (libcgrouptest01.c:254)                         
             
TEST 8:PASS : cgroup_modify_cgroup()             Ret Value = 0   Parameter same 
cgroup       
TEST 9:PASS : cgroup_new_cgroup()                Ret Value = 0                  
             
==12622==                                                                       
             
==12622== Conditional jump or move depends on uninitialised value(s)            
             
==12622==    at 0x4007271: strcpy (mc_replace_strmem.c:268)                     
             
==12622==    by 0x402F24B: cgroup_modify_cgroup (api.c:998)                     
             
==12622==    by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, 
int, int, int, int, int) (libcgrouptest01.c:889)
==12622==    by 0x804BD35: main (libcgrouptest01.c:286)                         
                                                
==12622==                                                                       
                                                
==12622== Conditional jump or move depends on uninitialised value(s)            
                                                
==12622==    at 0x4007285: strcpy (mc_replace_strmem.c:268)                     
                                                
==12622==    by 0x402F24B: cgroup_modify_cgroup (api.c:998)                     
                                                
==12622==    by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, 
int, int, int, int, int) (libcgrouptest01.c:889)
==12622==    by 0x804BD35: main (libcgrouptest01.c:286)                         
                                                
TEST10:PASS : cgroup_modify_cgroup()             Ret Value = 0                  
                                                
TEST11:PASS : cgroup_modify_cgroup()             Ret Value = 50007              
                                                
TEST12:PASS : cgroup_new_cgroup()                Ret Value = 0                  
                                                
==12622==                                                                       
                                                
==12622== Conditional jump or move depends on uninitialised value(s)            
                                                
==12622==    at 0x4007271: strcpy (mc_replace_strmem.c:268)                     
                                                
==12622==    by 0x402F24B: cgroup_modify_cgroup (api.c:998)                     
                                                
==12622==    by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, 
int, int, int, int, int) (libcgrouptest01.c:889)
==12622==    by 0x804BDF3: main (libcgrouptest01.c:314)                         
                                                
==12622==                                                                       
                                                
==12622== Conditional jump or move depends on uninitialised value(s)            
                                                
==12622==    at 0x4007285: strcpy (mc_replace_strmem.c:268)                     
                                                
==12622==    by 0x402F24B: cgroup_modify_cgroup (api.c:998)                     
                                                
==12622==    by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, 
int, int, int, int, int) (libcgrouptest01.c:889)
==12622==    by 0x804BDF3: main (libcgrouptest01.c:314)                         
                                                
TEST13:PASS : cgroup_modify_cgroup()             Ret Value = 0                  
                                                
TEST14:PASS : cgroup_get_cgroup()                Ret Value = 50007       
Parameter nullcgroup                                   
TEST15:PASS : cgroup_get_cgroup()                Ret Value = 50002       
Parameter not created group                            
TEST16:PASS : cgroup_get_cgroup()                Ret Value = 0                  
                                                
TEST 0:PASS : cgroup_new_cgroup()                Ret Value = 0                  
                                                
TEST 0:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in 
filesystem                                      
TEST17:FAIL : cgroup_get_cgroup()                Ret Value = 50017              
                                                
TEST16:PASS : cgroup_delete_cgroup()             Ret Value = 0   Group deleted 
from filesystem                                  
TEST17:PASS : cgroup_create_cgroup()             Ret Value = 50007              
                                                
TEST18:PASS : cgroup_delete_cgroup()             Ret Value = 50007              
                                                
TEST19:PASS : cgroup_compare_cgroup()            Ret Value = 50011       
Parameter nullcgroup                                   
TEST20:PASS : cgroup_compare_cgroup()            Ret Value = 0                  
                                                
TEST21:PASS : cgroup_compare_cgroup()            Ret Value = 50017              
                                                
==12622==                                                                       
                                                
==12622== ERROR SUMMARY: 45 errors from 10 contexts (suppressed: 18 from 1)     
                                                
==12622== malloc/free: in use at exit: 37 bytes in 6 blocks.                    
                                                
==12622== malloc/free: 186 allocs, 180 frees, 230,615 bytes allocated.          
                                                
==12622== For counts of detected errors, rerun with: -v                         
                                                
==12622== searching for pointers to 6 not-freed blocks.                         
                                                
==12622== checked 6,381,176 bytes.                                              
                                                
==12622==                                                                       
                                                
==12622==                                                                       
                                                
==12622== 37 bytes in 6 blocks are still reachable in loss record 1 of 1        
                                                
==12622==    at 0x4006AEE: malloc (vg_replace_malloc.c:207)                     
                                                
==12622==    by 0x402FD1E: cgroup_init (api.c:576)                              
                                                
==12622==    by 0x8049999: test_cgroup_init(int, int) (libcgrouptest01.c:655)   
                                                
==12622==    by 0x804BA44: main (libcgrouptest01.c:189)                         
                                                
==12622==                                                                       
                                                
==12622== LEAK SUMMARY:                                                         
                                                
==12622==    definitely lost: 0 bytes in 0 blocks.                              
                                                
==12622==      possibly lost: 0 bytes in 0 blocks.                              
                                                
==12622==    still reachable: 37 bytes in 6 blocks.                             
                                                
==12622==         suppressed: 0 bytes in 0 blocks.                              
                                                
Cleanup done                                                                    
                                                

Running third set of testcases
==============================
==12673== Memcheck, a memory error detector.
==12673== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==12673== Using LibVEX rev 1804, a library for dynamic binary translation.
==12673== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.       
==12673== Using valgrind-3.3.0, a dynamic binary instrumentation framework.
==12673== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.  
==12673== For more details, rerun with: -v                                 
==12673==                                                                  
C:DBG: fs_mounted as recieved from script=2                                
C:DBG: mountpoint1 as recieved from script=/dev/cgroup_controllers-1       
C:DBG: mountpoint2 as recieved from script=/dev/cgroup_controllers-2       
sanity check pass. cgroup                                                  
TEST 1:PASS : cgroup_init()                      Ret Value = 0             
TEST 2:PASS : cgroup_attach_task()               Ret Value = 0   Task found in 
group/s
TEST 3:PASS : cgroup_new_cgroup()                Ret Value = 0                  
      
TEST 4:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in 
filesystem
TEST 5:PASS : cgroup_new_cgroup()                Ret Value = 0                  
          
TEST 6:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in 
filesystem
TEST 7:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in 
filesystem
TEST 8:PASS : cgroup_attach_task()               Ret Value = 0   Task found in 
group/s    
TEST 9:PASS : cgroup_attach_task()               Ret Value = 0   Task found in 
group/s    
TEST10:PASS : cgroup_new_cgroup()                Ret Value = 0                  
          
TEST11:PASS : cgroup_attach_task()               Ret Value = 50002       
Parameter not created group
TEST12:PASS : cgroup_new_cgroup()                Ret Value = 0                  
                    
==12673== Conditional jump or move depends on uninitialised value(s)            
                    
==12673==    at 0x4007271: strcpy (mc_replace_strmem.c:268)                     
                    
==12673==    by 0x402F24B: cgroup_modify_cgroup (api.c:998)                     
                    
==12673==    by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, 
int, int, int, int, int) (libcgrouptest01.c:889)
==12673==    by 0x804C1D6: main (libcgrouptest01.c:498)                         
                                                
TEST13:PASS : cgroup_modify_cgroup()             Ret Value = 0                  
                                                
TEST14:PASS : cgroup_new_cgroup()                Ret Value = 0                  
                                                
==12673==                                                                       
                                                
==12673== Conditional jump or move depends on uninitialised value(s)            
                                                
==12673==    at 0x4007271: strcpy (mc_replace_strmem.c:268)                     
                                                
==12673==    by 0x402F24B: cgroup_modify_cgroup (api.c:998)                     
                                                
==12673==    by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, 
int, int, int, int, int) (libcgrouptest01.c:889)
==12673==    by 0x804C23C: main (libcgrouptest01.c:519)                         
                                                
==12673==                                                                       
                                                
==12673== Conditional jump or move depends on uninitialised value(s)
==12673==    at 0x4007285: strcpy (mc_replace_strmem.c:268)
==12673==    by 0x402F24B: cgroup_modify_cgroup (api.c:998)
==12673==    by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, 
int, int, int, int, int) (libcgrouptest01.c:889)
==12673==    by 0x804C23C: main (libcgrouptest01.c:519)
TEST15:PASS : cgroup_modify_cgroup()             Ret Value = 0
TEST16:PASS : cgroup_delete_cgroup()             Ret Value = 0   Group deleted 
from filesystem
TEST17:PASS : cgroup_delete_cgroup()             Ret Value = 0   Group deleted 
from filesystem
TEST18:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST19:PASS : cgroup_create_cgroup()             Ret Value = 0   group found 
under both controllers
TEST20:PASS : cgroup_attach_task()               Ret Value = 0   Task found in 
group/s
TEST21:PASS : cgroup_new_cgroup()                Ret Value = 0
==12673==
==12673== Conditional jump or move depends on uninitialised value(s)
==12673==    at 0x4007271: strcpy (mc_replace_strmem.c:268)
==12673==    by 0x402F24B: cgroup_modify_cgroup (api.c:998)
==12673==    by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, 
int, int, int, int, int) (libcgrouptest01.c:889)
==12673==    by 0x804C464: main (libcgrouptest01.c:622)
==12673==
==12673== Conditional jump or move depends on uninitialised value(s)
==12673==    at 0x4007285: strcpy (mc_replace_strmem.c:268)
==12673==    by 0x402F24B: cgroup_modify_cgroup (api.c:998)
==12673==    by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, 
int, int, int, int, int) (libcgrouptest01.c:889)
==12673==    by 0x804C464: main (libcgrouptest01.c:622)
TEST22:PASS : cgroup_modify_cgroup()             Ret Value = 0   group modified 
under both controllers
TEST23:PASS : cgroup_delete_cgroup()             Ret Value = 0   Group deleted 
from filesystem
TEST 0:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST 0:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in 
filesystem
TEST24:FAIL : cgroup_get_cgroup()                Ret Value = 50018
==12673==
==12673== ERROR SUMMARY: 79 errors from 5 contexts (suppressed: 18 from 1)
==12673== malloc/free: in use at exit: 66,081 bytes in 21 blocks.
==12673== malloc/free: 195 allocs, 174 frees, 224,638 bytes allocated.
==12673== For counts of detected errors, rerun with: -v
==12673== searching for pointers to 21 not-freed blocks.
==12673== checked 6,381,208 bytes.
==12673==
==12673==
==12673== 37 bytes in 6 blocks are still reachable in loss record 1 of 4
==12673==    at 0x4006AEE: malloc (vg_replace_malloc.c:207)
==12673==    by 0x402FD1E: cgroup_init (api.c:576)
==12673==    by 0x8049999: test_cgroup_init(int, int) (libcgrouptest01.c:655)
==12673==    by 0x804BF6F: main (libcgrouptest01.c:378)
==12673==
==12673==
==12673== 66,044 (18,064 direct, 47,980 indirect) bytes in 4 blocks are 
definitely lost in loss record 2 of 4
==12673==    at 0x4004BA2: calloc (vg_replace_malloc.c:397)
==12673==    by 0x4030D3A: cgroup_new_cgroup (wrapper.c:28)
==12673==    by 0x8049656: new_cgroup(char*, char*, char*, int, int) 
(libcgrouptest01.c:1132)
==12673==    by 0x8049917: create_new_cgroup_ds(int, char const*, int, int) 
(libcgrouptest01.c:744)
==12673==    by 0x804C190: main (libcgrouptest01.c:485)
==12673==
==12673==
==12673== 20,980 bytes in 5 blocks are indirectly lost in loss record 3 of 4
==12673==    at 0x4004BA2: calloc (vg_replace_malloc.c:397)
==12673==    by 0x4030BCC: cgroup_add_value_string (wrapper.c:122)
==12673==    by 0x8048FDB: _ZL17add_control_valueP17cgroup_controllerPcS1_i 
(libcgrouptest01.c:1113)
==12673==    by 0x80496C9: new_cgroup(char*, char*, char*, int, int) 
(libcgrouptest01.c:1147)
==12673==    by 0x8049917: create_new_cgroup_ds(int, char const*, int, int) 
(libcgrouptest01.c:744)
==12673==    by 0x804C190: main (libcgrouptest01.c:485)
==12673==
==12673==
==12673== 27,000 bytes in 6 blocks are indirectly lost in loss record 4 of 4
==12673==    at 0x4004BA2: calloc (vg_replace_malloc.c:397)
==12673==    by 0x4030EEB: cgroup_add_controller (wrapper.c:62)
==12673==    by 0x80496AE: new_cgroup(char*, char*, char*, int, int) 
(libcgrouptest01.c:1144)
==12673==    by 0x8049917: create_new_cgroup_ds(int, char const*, int, int) 
(libcgrouptest01.c:744)
==12673==    by 0x804C190: main (libcgrouptest01.c:485)
==12673==
==12673== LEAK SUMMARY:
==12673==    definitely lost: 18,064 bytes in 4 blocks.
==12673==    indirectly lost: 47,980 bytes in 11 blocks.
==12673==      possibly lost: 0 bytes in 0 blocks.
==12673==    still reachable: 37 bytes in 6 blocks.
==12673==         suppressed: 0 bytes in 0 blocks.
Cleanup done
[r...@gondor tests]#

A lot of these have been cleaned up. Also, once we reach the cleanup patches 
posted
earlier, we no longer have the library coming in the leak summaries or the
uninitialized summaries.

Please review, and ACK/NAK them so I can merge them in at the earliest.

Thanks,
-- 
regards,
Dhaval


------------------------------------------------------------------------------
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to