Skip to content
Snippets Groups Projects
Commit 789e6a2d authored by Jakob Olsson's avatar Jakob Olsson
Browse files

main culprit of memory leaks

parent 1792af1f
No related branches found
No related tags found
No related merge requests found
...@@ -228,7 +228,7 @@ void free_device(struct device *dev) ...@@ -228,7 +228,7 @@ void free_device(struct device *dev)
free(dev->ip); free(dev->ip);
free_usb(&(dev->usb)); free_usb(&(dev->usb));
free(&(dev->usb)); //free(&(dev->usb));
} }
void free_usb(struct USB *usb) void free_usb(struct USB *usb)
...@@ -551,9 +551,14 @@ char *get_device_ip(char *device_name) ...@@ -551,9 +551,14 @@ char *get_device_ip(char *device_name)
continue; continue;
host_flag = atoi(flags) & 4; host_flag = atoi(flags) & 4;
if (!host_flag) if (!host_flag) {
free(route);
free(iface);
free(destination);
free(gateway);
free(flags);
continue; continue;
}
ipv4_addr = (char *)calloc(1, IPV4_MAX); ipv4_addr = (char *)calloc(1, IPV4_MAX);
if (!ipv4_addr) if (!ipv4_addr)
break; break;
...@@ -561,8 +566,8 @@ char *get_device_ip(char *device_name) ...@@ -561,8 +566,8 @@ char *get_device_ip(char *device_name)
addr.s_addr = strtoul(destination, NULL, IPV4_MAX); addr.s_addr = strtoul(destination, NULL, IPV4_MAX);
inet_ntop(AF_INET, &(addr.s_addr), ipv4_addr, IPV4_MAX); inet_ntop(AF_INET, &(addr.s_addr), ipv4_addr, IPV4_MAX);
//printf("ipv4_addr %s\n", ipv4_addr); //printf("ipv4_addr %s\n", ipv4_addr);
}
}
free(route); free(route);
free(iface); free(iface);
free(destination); free(destination);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment