diff options
author | Gaoxiang Chen <gaochen@codeaurora.org> | 2014-04-16 15:15:05 +0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2014-04-24 19:54:28 -0700 |
commit | d29d0d636ad8eebd3f1d5b9baed5741c5fe95d0d (patch) | |
tree | de4eb9e8e6b35775f5f1212f1a10be3c71d2fed3 /jni/feature_mos/src | |
parent | 4180872a42f636db1d6c4b6e68a08bef95e189ee (diff) | |
download | android_packages_apps_Snap-d29d0d636ad8eebd3f1d5b9baed5741c5fe95d0d.tar.gz android_packages_apps_Snap-d29d0d636ad8eebd3f1d5b9baed5741c5fe95d0d.tar.bz2 android_packages_apps_Snap-d29d0d636ad8eebd3f1d5b9baed5741c5fe95d0d.zip |
Camera2: Fix camera application memory leak
This change fix potential memory leak of camera application
when swith between camera and panorama:
1. free allocated frames in jni/Mosaic
2. use application context instead of acitivity context
3. clear disappearing children of ViewGroup explicitly
4. remove IdleHandler during camera exit
CRs-fixed: 622518
Change-Id: I2583709489ab2cf1fc20865fe7d2a8f56f2763c9
Diffstat (limited to 'jni/feature_mos/src')
-rw-r--r-- | jni/feature_mos/src/mosaic/Mosaic.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/jni/feature_mos/src/mosaic/Mosaic.cpp b/jni/feature_mos/src/mosaic/Mosaic.cpp index 7b96fa5c5..9388b0a87 100644 --- a/jni/feature_mos/src/mosaic/Mosaic.cpp +++ b/jni/feature_mos/src/mosaic/Mosaic.cpp @@ -39,7 +39,7 @@ Mosaic::Mosaic() Mosaic::~Mosaic() { - for (int i = 0; i < frames_size; i++) + for (int i = 0; i < max_frames; i++) { if (frames[i]) delete frames[i]; @@ -77,7 +77,9 @@ int Mosaic::initialize(int blendingType, int stripType, int width, int height, i imageMosaicYVU = NULL; frames = new MosaicFrame *[max_frames]; + memset(frames, 0, sizeof(MosaicFrame *) * max_frames); rframes = new MosaicFrame *[max_frames]; + memset(rframes, 0, sizeof(MosaicFrame *) * max_frames); if(nframes>-1) { |