From ccda1f219d6a07b59d2ebf69f7c0864aba397098 Mon Sep 17 00:00:00 2001 From: Håkon Nessjøen Date: Mon, 27 Sep 2010 13:30:31 +0200 Subject: Forgot to free memory --- devices.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'devices.c') diff --git a/devices.c b/devices.c index 14ba5c4..387c73c 100644 --- a/devices.c +++ b/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; } -- cgit v1.2.3