mirror of
https://github.com/openvswitch/ovs
synced 2025-09-03 15:55:19 +00:00
connmgr: Free controller info in the same module where it's allocated.
Make ofproto_free_ofproto_controller_info() just a passthrough to connmgr_free_controller_info() so the allocation and freeing of memory in the controller info structure is done in the same place.
This commit is contained in:
@@ -416,6 +416,21 @@ connmgr_get_controller_info(struct connmgr *mgr, struct shash *info)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
connmgr_free_controller_info(struct shash *info)
|
||||||
|
{
|
||||||
|
struct shash_node *node;
|
||||||
|
|
||||||
|
SHASH_FOR_EACH (node, info) {
|
||||||
|
struct ofproto_controller_info *cinfo = node->data;
|
||||||
|
while (cinfo->pairs.n) {
|
||||||
|
free((char *) cinfo->pairs.values[--cinfo->pairs.n]);
|
||||||
|
}
|
||||||
|
free(cinfo);
|
||||||
|
}
|
||||||
|
shash_destroy(info);
|
||||||
|
}
|
||||||
|
|
||||||
/* Changes 'mgr''s set of controllers to the 'n_controllers' controllers in
|
/* Changes 'mgr''s set of controllers to the 'n_controllers' controllers in
|
||||||
* 'controllers'. */
|
* 'controllers'. */
|
||||||
void
|
void
|
||||||
|
@@ -66,6 +66,7 @@ void connmgr_retry(struct connmgr *);
|
|||||||
/* OpenFlow configuration. */
|
/* OpenFlow configuration. */
|
||||||
bool connmgr_has_controllers(const struct connmgr *);
|
bool connmgr_has_controllers(const struct connmgr *);
|
||||||
void connmgr_get_controller_info(struct connmgr *, struct shash *);
|
void connmgr_get_controller_info(struct connmgr *, struct shash *);
|
||||||
|
void connmgr_free_controller_info(struct shash *);
|
||||||
void connmgr_set_controllers(struct connmgr *,
|
void connmgr_set_controllers(struct connmgr *,
|
||||||
const struct ofproto_controller[], size_t n);
|
const struct ofproto_controller[], size_t n);
|
||||||
void connmgr_reconnect(const struct connmgr *);
|
void connmgr_reconnect(const struct connmgr *);
|
||||||
|
@@ -845,16 +845,7 @@ ofproto_get_ofproto_controller_info(const struct ofproto *ofproto,
|
|||||||
void
|
void
|
||||||
ofproto_free_ofproto_controller_info(struct shash *info)
|
ofproto_free_ofproto_controller_info(struct shash *info)
|
||||||
{
|
{
|
||||||
struct shash_node *node;
|
connmgr_free_controller_info(info);
|
||||||
|
|
||||||
SHASH_FOR_EACH (node, info) {
|
|
||||||
struct ofproto_controller_info *cinfo = node->data;
|
|
||||||
while (cinfo->pairs.n) {
|
|
||||||
free((char *) cinfo->pairs.values[--cinfo->pairs.n]);
|
|
||||||
}
|
|
||||||
free(cinfo);
|
|
||||||
}
|
|
||||||
shash_destroy(info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Makes a deep copy of 'old' into 'port'. */
|
/* Makes a deep copy of 'old' into 'port'. */
|
||||||
|
Reference in New Issue
Block a user