[ovs-dev] [PATCHv2 1/2] ofp-parse: Fix small memory leak when calling parse_ofp_meter_mod_str().
Ben Pfaff
blp at ovn.org
Wed Jul 5 23:09:07 UTC 2017
On Tue, Jun 27, 2017 at 06:14:43PM -0700, Justin Pettit wrote:
> 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 at ovn.org>
> ---
> v1->v2: Fix unitialized path.
I think there's still an uninitialized variable, fold this in?
diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index 2a6c82ec189f..6fb2cc08de50 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -3699,6 +3699,7 @@ 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);
The parsing code in ofctl_meter_mod__() and ofctl_meter_request__() is
almost identical and could be factored out.
Acked-by: Ben Pfaff <blp at ovn.org>
More information about the dev
mailing list