am 4ba5a8ac: am eafcbe10: am 072a0fac: Merge "Fixed adb crash due to accessing freed memory"

* commit '4ba5a8acba033127befd184f2f78cf0580995b07':
  Fixed adb crash due to accessing freed memory
This commit is contained in:
Nick Kralevich 2011-06-09 11:27:11 -07:00 committed by Android Git Automerger
commit 37b9fc6e7c
1 changed files with 5 additions and 2 deletions

View File

@ -225,10 +225,12 @@ static void local_socket_close_locked(asocket *s)
s->id, s->peer->id, s->peer->fd);
s->peer->peer = 0;
// tweak to avoid deadlock
if (s->peer->close == local_socket_close)
if (s->peer->close == local_socket_close) {
local_socket_close_locked(s->peer);
else
} else {
s->peer->close(s->peer);
}
s->peer = 0;
}
/* If we are already closing, or if there are no
@ -799,6 +801,7 @@ static void smart_socket_close(asocket *s)
if(s->peer) {
s->peer->peer = 0;
s->peer->close(s->peer);
s->peer = 0;
}
free(s);
}