gralloc: Move getAllocator in unlock

Call it where it is actually needed, as it may lead to
unnecessary logs in software composition

Change-Id: Ie0e266ee0710229f3cf15f8314e2ae4b4dc1ac94
diff --git a/libgralloc/mapper.cpp b/libgralloc/mapper.cpp
index 10d372a..30754dd 100644
--- a/libgralloc/mapper.cpp
+++ b/libgralloc/mapper.cpp
@@ -247,9 +247,9 @@
         return -EINVAL;
     int err = 0;
     private_handle_t* hnd = (private_handle_t*)handle;
-    IMemAlloc* memalloc = getAllocator(hnd->flags);
 
     if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION) {
+        IMemAlloc* memalloc = getAllocator(hnd->flags);
         if (hnd->flags & private_handle_t::PRIV_FLAGS_NEEDS_FLUSH) {
             err = memalloc->clean_buffer((void*)hnd->base,
                                          hnd->size, hnd->offset, hnd->fd,