diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | devices.c | 3 |
2 files changed, 4 insertions, 1 deletions
@@ -6,5 +6,5 @@ clean: dist-clean dist-clean: rm -f mactelnet -mactelnet: config.h main.c udp.h udp.c mactelnet.c mactelnet.h console.c console.h +mactelnet: config.h main.c udp.h udp.c mactelnet.c mactelnet.h console.c console.h devices.c devices.h gcc -g -o mactelnet -lcrypto main.c udp.c mactelnet.c console.c devices.c @@ -35,6 +35,7 @@ int getDeviceIp(const int sockfd, const unsigned char *deviceName, struct sockad ifc.ifc_req = ifr; if (ioctl(sockfd, SIOCGIFCONF, &ifc) != 0) { + free(ifr); return -1; } @@ -42,8 +43,10 @@ int getDeviceIp(const int sockfd, const unsigned char *deviceName, struct sockad for (i = 0; i < numDevices; ++i) { if (strcmp(ifr[i].ifr_name, deviceName) == 0) { memcpy(ip, &(ifr[i].ifr_addr), sizeof(ip)); + free(ifr); return 1; } } + free(ifr); return -1; } |