diff options
author | Justin Pettit <jpettit@ovn.org> | 2017-06-27 17:12:00 -0700 |
---|---|---|
committer | Justin Pettit <jpettit@ovn.org> | 2017-07-05 23:39:29 -0700 |
commit | 2f0b69ac79146ca7f0fcfb3a6bd24852192b8ec1 (patch) | |
tree | 41cb376020d75b34d529299428418ed375637e63 /utilities | |
parent | 642c824b36be9bdde1b3370a97221ae3ca5b4e5f (diff) | |
download | openvswitch-2f0b69ac79146ca7f0fcfb3a6bd24852192b8ec1.tar.gz |
ofp-parse: Fix small memory leak when calling parse_ofp_meter_mod_str().
The function parse_ofp_meter_mod_str() allocates a buffer called
'bands', which parse_ofp_meter_mod_str__() then steals for the member
'mm->meter.bands'. Calling functions didn't free that stolen value and
the comments for those function didn't indicate that was necessary.
Found by valgrind.
Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'utilities')
-rw-r--r-- | utilities/ovs-ofctl.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index ad862efe3..6fb2cc08d 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -3699,11 +3699,13 @@ ofctl_meter_mod__(const char *bridge, const char *str, int command) usable_protocols = OFPUTIL_P_OF13_UP; mm.command = command; mm.meter.meter_id = OFPM13_ALL; + mm.meter.bands = NULL; } protocol = open_vconn_for_flow_mod(bridge, &vconn, usable_protocols); version = ofputil_protocol_to_ofp_version(protocol); transact_noreply(vconn, ofputil_encode_meter_mod(version, &mm)); + free(mm.meter.bands); vconn_close(vconn); } @@ -3726,12 +3728,14 @@ ofctl_meter_request__(const char *bridge, const char *str, } else { usable_protocols = OFPUTIL_P_OF13_UP; mm.meter.meter_id = OFPM13_ALL; + mm.meter.bands = NULL; } protocol = open_vconn_for_flow_mod(bridge, &vconn, usable_protocols); version = ofputil_protocol_to_ofp_version(protocol); dump_transaction(vconn, ofputil_encode_meter_request(version, type, mm.meter.meter_id)); + free(mm.meter.bands); vconn_close(vconn); } |