Merge "Close FILE* handles after consuming contents"
diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c
index 8a65f7c..38d3184 100644
--- a/mDNSPosix/mDNSPosix.c
+++ b/mDNSPosix/mDNSPosix.c
@@ -523,7 +523,10 @@
 			mDNS_AddDNSServer(m, NULL, mDNSInterface_Any, &DNSAddr, UnicastDNSPort, mDNSfalse, 0);
 			numOfServers++;
 			}
-		}  
+		}
+    //  __ANDROID__ : if fp was opened, it needs to be closed
+	int fp_closed = fclose(fp);
+	assert(fp_closed == 0);
 	return (numOfServers > 0) ? 0 : -1;
 	}
 
diff --git a/mDNSPosix/mDNSUNP.c b/mDNSPosix/mDNSUNP.c
index 64f66e1..c3d3366 100755
--- a/mDNSPosix/mDNSUNP.c
+++ b/mDNSPosix/mDNSUNP.c
@@ -83,7 +83,7 @@
 struct ifi_info *get_ifi_info_linuxv6(int family, int doaliases)
 	{
 		struct ifi_info *ifi, *ifihead, **ifipnext, *ifipold, **ifiptr;
-	FILE *fp;
+	FILE *fp = NULL;
 	char addr[8][5];
 	int flags, myflags, index, plen, scope;
 	char ifname[9], lastname[IFNAMSIZ];
@@ -208,7 +208,12 @@
 // __ANDROID__ : replaced assert(close(..))
 		int sockfd_closed = close(sockfd);
 		assert(sockfd_closed == 0);
-	}
+		}
+// __ANDROID__ : if fp was opened, it needs to be closed
+	if (fp != NULL) {
+		int fd_closed = fclose(fp);
+		assert(fd_closed == 0);
+		}
 	return(ifihead);    /* pointer to first structure in linked list */
 	}
 #endif // defined(AF_INET6) && HAVE_IPV6 && HAVE_LINUX