[ovs-dev,2/4] ovn-northd: Fix memory leak

Message ID 1515779132-28902-2-git-send-email-pkusunyifeng@gmail.com
State New
Headers show
Series
  • [ovs-dev,1/4] pinctrl: Fix memory leak
Related show

Commit Message

Yifeng Sun Jan. 12, 2018, 5:45 p.m.
This leak was reported by valgrind (testing ovn -- IPv6 Neighbor
Solicitation for unknown MAC):

3,027 bytes in 49 blocks are definitely lost in loss record 210 of 218                
    by 0x484C84: xrealloc (util.c:131)                                                 
    by 0x43CE41: ds_reserve (dynamic-string.c:63)                                      
    by 0x43D29D: ds_put_format_valist (dynamic-string.c:161)                           
    by 0x43D3A3: ds_put_format (dynamic-string.c:142)                                  
    by 0x412EEF: ovn_port_update_sbrec (ovn-northd.c:1948)                             
    by 0x4148B4: build_ports (ovn-northd.c:2109)                       
    by 0x4148B4: ovnnb_db_run.isra.37 (ovn-northd.c:6202)              
    by 0x406FE0: main (ovn-northd.c:6854)

Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
---
 ovn/northd/ovn-northd.c | 1 +
 1 file changed, 1 insertion(+)

Patch

diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index 63ed97e..902392f 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -1949,6 +1949,7 @@  ovn_port_update_sbrec(struct northd_context *ctx,
         }
         const char *addresses = ds_cstr(&s);
         sbrec_port_binding_set_mac(op->sb, &addresses, 1);
+        ds_destroy(&s);
 
         struct smap ids = SMAP_INITIALIZER(&ids);
         sbrec_port_binding_set_external_ids(op->sb, &ids);