system/corennnnn
Revision | f6d51cd8143a3e7f64321b8df6120498057e58b7 (tree) |
---|---|
Zeit | 2016-09-04 08:47:15 |
Autor | Josh Gao <jmgao@goog...> |
Commiter | Steve Kondik |
adb: fix fd leak when shell fails to create a thread.
Bug: http://b/29565233
Change-Id: Ia59c6dbe5ac033425c11739579e85cbcad1170d1
@@ -778,13 +778,14 @@ int StartSubprocess(const char* name, const char* terminal_type, | ||
778 | 778 | return ReportError(protocol, error); |
779 | 779 | } |
780 | 780 | |
781 | - int local_socket = subprocess->ReleaseLocalSocket(); | |
782 | - D("subprocess creation successful: local_socket_fd=%d, pid=%d", local_socket, subprocess->pid()); | |
781 | + unique_fd local_socket(subprocess->ReleaseLocalSocket()); | |
782 | + D("subprocess creation successful: local_socket_fd=%d, pid=%d", local_socket.get(), | |
783 | + subprocess->pid()); | |
783 | 784 | |
784 | 785 | if (!Subprocess::StartThread(std::move(subprocess), &error)) { |
785 | 786 | LOG(ERROR) << "failed to start subprocess management thread: " << error; |
786 | 787 | return ReportError(protocol, error); |
787 | 788 | } |
788 | 789 | |
789 | - return local_socket; | |
790 | + return local_socket.release(); | |
790 | 791 | } |