[Skia]: fix TOMBSTONE issue when browsing JPEG image and exiting Gallery
When browsing JPEG image and then exiting Gallery, the TOMBSTONE issue
occour. This is because JPEG Decode method still access a pointer which has been deleted.
This patch can fix it.
Change-Id: I3ac3e4b8f37d352a70676abb6d151961e873e459
Author: Zhongjun Chen <zhongjunx.chen@intel.com>
Signed-off-by: Zhongjun Chen <zhongjunx.chen@intel.com>
Singed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 37479
diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkImageDecoder_libjpeg.cpp
index fbb6887..33f222c 100644
--- a/src/images/SkImageDecoder_libjpeg.cpp
+++ b/src/images/SkImageDecoder_libjpeg.cpp
@@ -48,9 +48,9 @@
SkJPEGImageIndex() {}
virtual ~SkJPEGImageIndex() {
jpeg_destroy_huffman_index(index);
- delete cinfo->src;
jpeg_finish_decompress(cinfo);
jpeg_destroy_decompress(cinfo);
+ delete cinfo->src;
free(cinfo);
}
jpeg_decompress_struct *cinfo;