Skip to content

Commit

Permalink
lport: Tolerate null pointers in destroy functions.
Browse files Browse the repository at this point in the history
The coding style says to do this.

The actual caller doesn't pass a null pointer.

Signed-off-by: Ben Pfaff <[email protected]>
Acked-by: Mickey Spiegel <[email protected]>
  • Loading branch information
blp committed Dec 20, 2016
1 parent 4fbc56c commit 69d21a9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ovn/controller/lport.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ lport_index_init(struct lport_index *lports, struct ovsdb_idl *ovnsb_idl)
void
lport_index_destroy(struct lport_index *lports)
{
if (!lports) {
return;
}

/* Destroy all of the "struct lport"s.
*
* We don't have to remove the node from both indexes. */
Expand Down Expand Up @@ -141,6 +145,10 @@ mcgroup_index_init(struct mcgroup_index *mcgroups, struct ovsdb_idl *ovnsb_idl)
void
mcgroup_index_destroy(struct mcgroup_index *mcgroups)
{
if (!mcgroups) {
return;
}

struct mcgroup *mcgroup, *next;
HMAP_FOR_EACH_SAFE (mcgroup, next, dp_name_node, &mcgroups->by_dp_name) {
hmap_remove(&mcgroups->by_dp_name, &mcgroup->dp_name_node);
Expand Down

0 comments on commit 69d21a9

Please sign in to comment.