bridge: Always call smap_destroy() after smap_init()
authorAlex Wang <alexw@nicira.com>
Thu, 12 Sep 2013 18:54:16 +0000 (11:54 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 12 Sep 2013 21:33:41 +0000 (14:33 -0700)
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() may be modified to allocate dynamic memory.

Reported-by: Ansis Atteka <aatteka@nicira.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
vswitchd/bridge.c

index f993ba1..57a4faf 100644 (file)
@@ -2265,8 +2265,8 @@ instant_stats_run(void)
                 if (!ofproto_port_get_bfd_status(br->ofproto, iface->ofp_port,
                                                  &smap)) {
                     ovsrec_interface_set_bfd_status(iface->cfg, &smap);
-                    smap_destroy(&smap);
                 }
+                smap_destroy(&smap);
             }
         }
     }