Skip to content

Commit

Permalink
ovn-controller: Fix memory leak and bug in setup_qos().
Browse files Browse the repository at this point in the history
The caller of netdev_get_qos() is responsible for freeing its 'details'
smap.

Also, the previous qdisc details, for some arbitrary previous type of QoS,
aren't relevant for changing the type of QoS.

Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
blp committed Feb 1, 2017
1 parent e2218ee commit 6094fc7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ovn/controller/binding.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2015, 2016 Nicira, Inc.
/* Copyright (c) 2015, 2016, 2017 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -251,11 +251,14 @@ setup_qos(const char *egress_iface, struct hmap *queue_map)
smap_init(&qdisc_details);
if (netdev_get_qos(netdev_phy, &qdisc_type, &qdisc_details) != 0 ||
qdisc_type[0] == '\0') {
smap_destroy(&qdisc_details);
/* Qos is not supported. */
return;
}
smap_destroy(&qdisc_details);

if (strcmp(qdisc_type, OVN_QOS_TYPE)) {
error = netdev_set_qos(netdev_phy, OVN_QOS_TYPE, &qdisc_details);
error = netdev_set_qos(netdev_phy, OVN_QOS_TYPE, NULL);
if (error) {
VLOG_WARN_RL(&rl, "%s: could not configure QoS (%s)",
egress_iface, ovs_strerror(error));
Expand Down

0 comments on commit 6094fc7

Please sign in to comment.