[ovs-dev] [PATCH 1/2] ovsdb-idl: properly destroy ovsdb_idl.server

Yifeng Sun pkusunyifeng at gmail.com
Tue Apr 3 17:12:58 UTC 2018


This patch fixes the memory leak reported by valgrind in testing
"learning action - TCPv6 port learning"

150 (40 direct, 110 indirect) bytes in 1 blocks are definitely lost in loss record 329 of 363                                                                                    
at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x51D0D4: xmalloc (util.c:120)                                   
by 0x572E17: json_create (json.c:1442)                              
by 0x572E17: json_array_create (json.c:217)                         
by 0x572E17: json_array_create_2 (json.c:238)                       
by 0x4F69EA: ovsdb_idl_db_init (ovsdb-idl.c:424)                    
by 0x4F6A58: ovsdb_idl_create (ovsdb-idl.c:454)                     
by 0x40FAC7: bridge_init (bridge.c:396)                             
by 0x406F93: main (ovs-vswitchd.c:106)                              
                                                                        
3,727 (40 direct, 3,687 indirect) bytes in 1 blocks are definitely lost in loss record 358 of 363                                                                                
at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x51D0D4: xmalloc (util.c:120)                                   
by 0x572EBA: json_create (json.c:1442)                              
by 0x572EBA: json_object_create (json.c:254)                        
by 0x573254: json_parser_push_object (json.c:1264)                  
by 0x573254: json_parse_value.isra.12 (json.c:1293)                 
by 0x57339F: json_parser_input (json.c:1398)                        
by 0x5742C1: json_lex_input (json.c:982)                            
by 0x5748EB: json_parser_feed (json.c:1140)                         
by 0x57597A: jsonrpc_recv.part.7 (jsonrpc.c:332)                    
by 0x5768A7: jsonrpc_recv (jsonrpc.c:1140)                          
by 0x5768A7: jsonrpc_session_recv (jsonrpc.c:1113)                  
by 0x4F4E5C: ovsdb_idl_run (ovsdb-idl.c:818)                        
by 0x4100F9: bridge_run (bridge.c:2949)                             
by 0x406FB4: main (ovs-vswitchd.c:121)  

Signed-off-by: Yifeng Sun <pkusunyifeng at gmail.com>
---
 lib/ovsdb-idl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
index eb28988b8127..49680d6ea330 100644
--- a/lib/ovsdb-idl.c
+++ b/lib/ovsdb-idl.c
@@ -516,6 +516,7 @@ ovsdb_idl_destroy(struct ovsdb_idl *idl)
         ovsdb_idl_clear(idl);
         jsonrpc_session_close(idl->session);
 
+        ovsdb_idl_db_destroy(&idl->server);
         ovsdb_idl_db_destroy(&idl->data);
         json_destroy(idl->request_id);
         free(idl);
-- 
2.7.4



More information about the dev mailing list