ANW: fix an fd leak

Change-Id: Id44cae6732c6694d2f470cbdfa5f59e7474f704f
This commit is contained in:
Jamie Gennis 2012-09-20 11:43:43 -07:00
parent e1df9ad215
commit 9bd8dd3b13
1 changed files with 2 additions and 3 deletions

View File

@ -828,9 +828,8 @@ static inline int native_window_dequeue_buffer_and_wait(ANativeWindow *anw,
int err = anw->dequeueBuffer(anw, anb, &fenceFd);
if (err == 0 && fenceFd != -1) {
err = sync_wait(fenceFd, UINT_MAX);
if (err == 0) {
close(fenceFd);
} else {
close(fenceFd);
if (err != 0) {
anw->cancelBuffer(anw, *anb, fenceFd);
*anb = NULL;
}