summaryrefslogtreecommitdiffstats
path: root/include/system/window.h
diff options
context:
space:
mode:
authorJamie Gennis <jgennis@google.com>2012-09-20 11:43:43 -0700
committerJamie Gennis <jgennis@google.com>2012-09-20 11:43:43 -0700
commit9bd8dd3b13a0d690c9316ed31be7c9a13f3f439f (patch)
treea9a5856915a64d540380417b74fd302aca439c0c /include/system/window.h
parente1df9ad215af6e51a2d8fb1d0306e00c7b510b62 (diff)
downloadsystem_core-9bd8dd3b13a0d690c9316ed31be7c9a13f3f439f.zip
system_core-9bd8dd3b13a0d690c9316ed31be7c9a13f3f439f.tar.gz
system_core-9bd8dd3b13a0d690c9316ed31be7c9a13f3f439f.tar.bz2
ANW: fix an fd leak
Change-Id: Id44cae6732c6694d2f470cbdfa5f59e7474f704f
Diffstat (limited to 'include/system/window.h')
-rw-r--r--include/system/window.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/include/system/window.h b/include/system/window.h
index 685e068..1e7f114 100644
--- a/include/system/window.h
+++ b/include/system/window.h
@@ -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;
}