Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[network] Fix minor resource leak. Fixes: CID#1230273
Free the network interface name in case it does not exist,
so it does not get overwritten by the next possible interface.

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
  • Loading branch information
philippedeswert committed Aug 5, 2014
1 parent ea22c60 commit 642e806
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/usb_moded-network.c
Expand Up @@ -106,6 +106,8 @@ static char* get_interface(struct mode_list_elem *data)

if(interface == NULL || check != 0)
{
if(interface != NULL)
free((char *)interface);
interface = malloc(sizeof(default_interface)*sizeof(char));
strncpy(interface, default_interface, sizeof(default_interface));
}
Expand Down

0 comments on commit 642e806

Please sign in to comment.