8000203: File descriptor leak in src/solaris/native/java/net/net_util_md.c
Reviewed-by: dsamersoff, khazra, chegar
Contributed-by: John Zavgren <john.zavgren@oracle.com>
--- a/jdk/src/solaris/native/java/net/net_util_md.c Wed Oct 24 20:44:07 2012 +0100
+++ b/jdk/src/solaris/native/java/net/net_util_md.c Wed Oct 24 21:20:40 2012 +0100
@@ -546,6 +546,7 @@
char dest_str[40];
struct in6_addr dest_addr;
char device[16];
+ struct loopback_route *loRoutesTemp;
if (loRoutes != 0) {
free (loRoutes);
@@ -606,11 +607,15 @@
continue;
} else {
if (nRoutes == loRoutes_size) {
- loRoutes = realloc (loRoutes, loRoutes_size *
- sizeof (struct loopback_route) * 2);
- if (loRoutes == 0) {
- return ;
+ loRoutesTemp = realloc (loRoutes, loRoutes_size *
+ sizeof (struct loopback_route) * 2);
+
+ if (loRoutesTemp == 0) {
+ free(loRoutes);
+ fclose (f);
+ return;
}
+ loRoutes=loRoutesTemp;
loRoutes_size *= 2;
}
memcpy (&loRoutes[nRoutes].addr,&dest_addr,sizeof(struct in6_addr));