Skip to content

Commit

Permalink
Merge "Fixed adb crash due to accessing freed memory"
Browse files Browse the repository at this point in the history
  • Loading branch information
nickkral authored and Android Code Review committed Jun 7, 2011
2 parents 4c0b9e3 + 49f1857 commit 072a0fa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions adb/sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 072a0fa

Please sign in to comment.