8080402: File Leak in jdk/src/java.base/share/classes/sun/net/sdp/SdpSupport.java
Reviewed-by: alanb, chegar, igerasim, msheppar
Contributed-by: vyom.tewari@oracle.com
--- a/jdk/src/java.base/unix/native/libnet/SdpSupport.c Thu Sep 10 11:44:14 2015 +0200
+++ b/jdk/src/java.base/unix/native/libnet/SdpSupport.c Thu Sep 10 17:14:59 2015 +0200
@@ -118,6 +118,8 @@
RESTARTABLE(dup2(s, fd), res);
if (res < 0)
JNU_ThrowIOExceptionWithLastError(env, "dup2");
- RESTARTABLE(close(s), res);
+ res = close(s);
+ if (res < 0 && !(*env)->ExceptionOccurred(env))
+ JNU_ThrowIOExceptionWithLastError(env, "close");
}
}