Merge "Fix a potential memory leak" am: f583ff660e

am: 6677429bff

Change-Id: I47d668eb5f56dd51f99415e50ff7f3ab901a18e1
This commit is contained in:
Ting-Yuan Huang 2017-08-16 17:18:44 +00:00 committed by android-build-merger
commit 6deffe3c3b

View file

@ -478,11 +478,17 @@ asocket* host_service_to_socket(const char* name, const char* serial) {
return nullptr;
}
int fd = create_service_thread(wait_for_state, sinfo.release());
int fd = create_service_thread(wait_for_state, sinfo.get());
if (fd != -1) {
sinfo.release();
}
return create_local_socket(fd);
} else if (!strncmp(name, "connect:", 8)) {
char* host = strdup(name + 8);
int fd = create_service_thread(connect_service, host);
if (fd == -1) {
free(host);
}
return create_local_socket(fd);
}
return NULL;