Merge "Cleanup sloppy memory handling in ExifOutputStream." into gb-ub-photos-bryce
diff --git a/gallerycommon/src/com/android/gallery3d/exif/ExifOutputStream.java b/gallerycommon/src/com/android/gallery3d/exif/ExifOutputStream.java
index e5a5bf0..38b34fc 100644
--- a/gallerycommon/src/com/android/gallery3d/exif/ExifOutputStream.java
+++ b/gallerycommon/src/com/android/gallery3d/exif/ExifOutputStream.java
@@ -75,6 +75,7 @@
     private int mState = STATE_SOI;
     private int mByteToSkip;
     private int mByteToCopy;
+    private byte[] mSingleByteArray = new byte[1];
     private ByteBuffer mBuffer = ByteBuffer.allocate(4);
     private final ExifInterface mInterface;
 
@@ -190,10 +191,8 @@
      */
     @Override
     public void write(int oneByte) throws IOException {
-        byte[] buf = new byte[] {
-            (byte) (0xff & oneByte)
-        };
-        write(buf);
+        mSingleByteArray[0] = (byte) (0xff & oneByte);
+        write(mSingleByteArray);
     }
 
     /**