OSDN Git Service

Fix descriptor leak after accepting connections
authorDave Platt <dplatt@google.com>
Fri, 6 Dec 2013 22:03:47 +0000 (14:03 -0800)
committerdcashman <dcashman@google.com>
Mon, 6 Jan 2014 22:31:28 +0000 (14:31 -0800)
After accepting a connection on a listening socket and
storing the resulting FileDescriptor into a newly created
LocalSocketImpl, the new impl's "descriptor was created
locally and should be closed normally" flag should be set.

Bug: 11805817

(cherry picked from commit 3e7305c6bf6062b5cb1e2ddcec6c6d30b4a8bc0d)

Change-Id: I723d7c5544ee4b6858894c215716cbc32a958df1

core/java/android/net/LocalSocketImpl.java

index b2ee50a..119e533 100644 (file)
@@ -326,6 +326,7 @@ class LocalSocketImpl
         }
 
         s.fd = accept(fd, s);
+        s.mFdCreatedInternally = true;
     }
 
     /**
@@ -536,4 +537,3 @@ class LocalSocketImpl
         close();
     }
 }
-