Skip to content

Commit

Permalink
config: Use the proper create/destroy API for network interfaces.
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
  • Loading branch information
richardcochran committed Mar 4, 2020
1 parent 52482e0 commit 812e0df
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -829,13 +829,11 @@ struct interface *config_create_interface(const char *name, struct config *cfg)
return iface;
}

iface = calloc(1, sizeof(struct interface));
iface = interface_create(name);
if (!iface) {
fprintf(stderr, "cannot allocate memory for a port\n");
return NULL;
}

interface_set_name(iface, name);
STAILQ_INSERT_TAIL(&cfg->interfaces, iface, list);
cfg->n_interfaces++;

Expand Down Expand Up @@ -906,7 +904,7 @@ void config_destroy(struct config *cfg)

while ((iface = STAILQ_FIRST(&cfg->interfaces))) {
STAILQ_REMOVE_HEAD(&cfg->interfaces, list);
free(iface);
interface_destroy(iface);
}
while ((table = STAILQ_FIRST(&cfg->unicast_master_tables))) {
while ((address = STAILQ_FIRST(&table->addrs))) {
Expand Down

0 comments on commit 812e0df

Please sign in to comment.