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

* commit '072a0fac3cabd50c2089d987b5abceac35c74570':
  Fixed adb crash due to accessing freed memory
This commit is contained in:
Nick Kralevich 2011-06-07 16:21:09 -07:00 committed by Android Git Automerger
commit eafcbe109f

View file

@ -221,10 +221,12 @@ static void local_socket_close_locked(asocket *s)
if(s->peer) {
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
@ -782,6 +784,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);
}