8080402: File Leak in jdk/src/java.base/share/classes/sun/net/sdp/SdpSupport.java
authordfuchs
Thu, 10 Sep 2015 17:14:59 +0200
changeset 32512 89cd776e3a25
parent 32511 3037b7753a1d
child 32513 e0545ceeadd7
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
jdk/src/java.base/unix/native/libnet/SdpSupport.c
--- 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");
     }
 }