Thanks for the patch. I'll apply this next week when I get back from vacation. On Jul 1, 2013 9:32 AM, "Jarno Rajahalme" <jarno.rajaha...@nsn.com> wrote:
> Ben noticed that I had forgot to free meters when ofproto is freed. > This should do it. > > Signed-off-by: Jarno Rajahalme <jarno.rajaha...@nsn.com> > --- > ofproto/ofproto.c | 33 +++++++++++++++++++++++---------- > 1 file changed, 23 insertions(+), 10 deletions(-) > > diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c > index 522c839..8b4e039 100644 > --- a/ofproto/ofproto.c > +++ b/ofproto/ofproto.c > @@ -213,6 +213,7 @@ static uint64_t pick_datapath_id(const struct ofproto > *); > static uint64_t pick_fallback_dpid(void); > static void ofproto_destroy__(struct ofproto *); > static void update_mtu(struct ofproto *, struct ofport *); > +static void meter_delete(struct ofproto *, uint32_t first, uint32_t last); > > /* unixctl. */ > static void ofproto_unixctl_init(void); > @@ -1085,6 +1086,11 @@ ofproto_destroy__(struct ofproto *ofproto) > ovs_assert(list_is_empty(&ofproto->pending)); > ovs_assert(!ofproto->n_pending); > > + if (ofproto->meters) { > + meter_delete(ofproto, 1, ofproto->meter_features.max_meters); > + free(ofproto->meters); > + } > + > connmgr_destroy(ofproto->connmgr); > > hmap_remove(&all_ofprotos, &ofproto->hmap_node); > @@ -4255,6 +4261,22 @@ meter_create(const struct ofputil_meter_config > *config, > return meter; > } > > +static void > +meter_delete(struct ofproto *ofproto, uint32_t first, uint32_t last) > +{ > + uint32_t mid; > + for (mid = first; mid <= last; ++mid) { > + struct meter *meter = ofproto->meters[mid]; > + if (meter) { > + ofproto->meters[mid] = NULL; > + ofproto->ofproto_class->meter_del(ofproto, > + meter->provider_meter_id); > + free(meter->bands); > + free(meter); > + } > + } > +} > + > static enum ofperr > handle_add_meter(struct ofproto *ofproto, struct ofputil_meter_mod *mm) > { > @@ -4335,16 +4357,7 @@ handle_delete_meter(struct ofconn *ofconn, const > struct ofp_header *oh, > } > > /* Delete the meters. */ > - for (meter_id = first; meter_id <= last; ++meter_id) { > - struct meter *meter = ofproto->meters[meter_id]; > - if (meter) { > - ofproto->meters[meter_id] = NULL; > - ofproto->ofproto_class->meter_del(ofproto, > - meter->provider_meter_id); > - free(meter->bands); > - free(meter); > - } > - } > + meter_delete(ofproto, first, last); > > return 0; > } > -- > 1.7.10.4 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev >
_______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev