changeset 12721:f36fe8adbbd4

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
author dfuchs
date Thu, 10 Sep 2015 17:14:59 +0200
parents da4a7b180e51
children 4b948e5a3e77
files src/java.base/unix/native/libnet/SdpSupport.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/unix/native/libnet/SdpSupport.c	Thu Sep 10 11:44:14 2015 +0200
+++ b/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");
     }
 }