Merge "Avoid closing invalid fds in GraphicBufferMapper" am: 8260e06c50 am: 8fe617eaad
am: 9ef13167c9

Change-Id: I2193d68e72ed234c2dc603ea485f89c1ea4eee19
diff --git a/libs/ui/GraphicBufferMapper.cpp b/libs/ui/GraphicBufferMapper.cpp
index d52c508..1634328 100644
--- a/libs/ui/GraphicBufferMapper.cpp
+++ b/libs/ui/GraphicBufferMapper.cpp
@@ -99,7 +99,7 @@
 {
     int32_t fenceFd = -1;
     status_t error = unlockAsync(handle, &fenceFd);
-    if (error == NO_ERROR) {
+    if (error == NO_ERROR && fenceFd >= 0) {
         sync_wait(fenceFd, -1);
         close(fenceFd);
     }