Skip to content

Commit

Permalink
Clean-up ipforward data completely
Browse files Browse the repository at this point in the history
Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
  • Loading branch information
philippedeswert committed Dec 15, 2013
1 parent eb5d759 commit 47b2cbe
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/usb_moded-network.c
Expand Up @@ -51,6 +51,17 @@ typedef struct ipforward_data
char *nat_interface;
}ipforward_data;

static void free_ipforward_data (struct ipforward_data *ipforward)
{
if(ipforward)
{
free(ipforward->dns1);
free(ipforward->dns2);
free(ipforward->interface);
free(ipforward->nat_interface);
}
}

static char* get_interface(struct mode_list_elem *data)
{
char *interface = NULL;
Expand Down Expand Up @@ -452,8 +463,8 @@ int usb_network_set_up_dhcpd(struct mode_list_elem *data)


end:
if(ipforward)
free(ipforward);
/* the function checks if ipforward is NULL or not */
free_ipforward_data(ipforward);
return(0);
}

Expand Down

0 comments on commit 47b2cbe

Please sign in to comment.