Loading adb/services.cpp +8 −6 Original line number Original line Diff line number Diff line Loading @@ -618,16 +618,15 @@ void connect_emulator(const std::string& port_spec, std::string* response) { } } } } static void connect_service(int fd, void* cookie) static void connect_service(int fd, void* data) { { char* host = reinterpret_cast<char*>(data); char *host = reinterpret_cast<char*>(cookie); std::string response; std::string response; if (!strncmp(host, "emu:", 4)) { if (!strncmp(host, "emu:", 4)) { connect_emulator(host + 4, &response); connect_emulator(host + 4, &response); } else { } else { connect_device(host, &response); connect_device(host, &response); } } free(host); // Send response for emulator and device // Send response for emulator and device SendProtocolString(fd, response); SendProtocolString(fd, response); Loading Loading @@ -664,6 +663,9 @@ asocket* host_service_to_socket(const char* name, const char *serial) sinfo->transport_type = kTransportAny; sinfo->transport_type = kTransportAny; sinfo->state = CS_DEVICE; sinfo->state = CS_DEVICE; } else { } else { if (sinfo->serial) { free(sinfo->serial); } free(sinfo); free(sinfo); return NULL; return NULL; } } Loading @@ -671,8 +673,8 @@ asocket* host_service_to_socket(const char* name, const char *serial) int fd = create_service_thread(wait_for_state, sinfo); int fd = create_service_thread(wait_for_state, sinfo); return create_local_socket(fd); return create_local_socket(fd); } else if (!strncmp(name, "connect:", 8)) { } else if (!strncmp(name, "connect:", 8)) { const char *host = name + 8; char* host = strdup(name + 8); int fd = create_service_thread(connect_service, (void *)host); int fd = create_service_thread(connect_service, host); return create_local_socket(fd); return create_local_socket(fd); } } return NULL; return NULL; Loading Loading
adb/services.cpp +8 −6 Original line number Original line Diff line number Diff line Loading @@ -618,16 +618,15 @@ void connect_emulator(const std::string& port_spec, std::string* response) { } } } } static void connect_service(int fd, void* cookie) static void connect_service(int fd, void* data) { { char* host = reinterpret_cast<char*>(data); char *host = reinterpret_cast<char*>(cookie); std::string response; std::string response; if (!strncmp(host, "emu:", 4)) { if (!strncmp(host, "emu:", 4)) { connect_emulator(host + 4, &response); connect_emulator(host + 4, &response); } else { } else { connect_device(host, &response); connect_device(host, &response); } } free(host); // Send response for emulator and device // Send response for emulator and device SendProtocolString(fd, response); SendProtocolString(fd, response); Loading Loading @@ -664,6 +663,9 @@ asocket* host_service_to_socket(const char* name, const char *serial) sinfo->transport_type = kTransportAny; sinfo->transport_type = kTransportAny; sinfo->state = CS_DEVICE; sinfo->state = CS_DEVICE; } else { } else { if (sinfo->serial) { free(sinfo->serial); } free(sinfo); free(sinfo); return NULL; return NULL; } } Loading @@ -671,8 +673,8 @@ asocket* host_service_to_socket(const char* name, const char *serial) int fd = create_service_thread(wait_for_state, sinfo); int fd = create_service_thread(wait_for_state, sinfo); return create_local_socket(fd); return create_local_socket(fd); } else if (!strncmp(name, "connect:", 8)) { } else if (!strncmp(name, "connect:", 8)) { const char *host = name + 8; char* host = strdup(name + 8); int fd = create_service_thread(connect_service, (void *)host); int fd = create_service_thread(connect_service, host); return create_local_socket(fd); return create_local_socket(fd); } } return NULL; return NULL; Loading