[ovs-dev] [PATCH V2 2/2] bridge: Always call smap_destroy() after smap_init()

Alex Wang alexw at nicira.com
Thu Sep 12 17:01:14 UTC 2013


This commit fixes a place in bridge.c where smap_destroy() is not
always called after smap_init().  Though there is no memory leak
now, it is necessary to fix it and prevent memory leak in the
future when smap_init() is modified to allocate dynamic memory.

Reported-by: Ansis Atteka <aatteka at nicira.com>
Signed-off-by: Alex Wang <alexw at nicira.com>

---

v1 -> v2:
- refine commit log title.

---
 vswitchd/bridge.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index f49292b..ba066da 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -2263,8 +2263,8 @@ instant_stats_run(void)
                                                     &smap);
                 if (!error || error == ENOENT) {
                     ovsrec_interface_set_bfd_status(iface->cfg, &smap);
-                    smap_destroy(&smap);
                 }
+                smap_destroy(&smap);
             }
         }
     }
-- 
1.7.9.5




More information about the dev mailing list