From e443ffac2a09b69470c4663ee031a527c53738d9 Mon Sep 17 00:00:00 2001 From: "soon1.choi" Date: Mon, 5 Jan 2015 14:27:42 +0900 Subject: DO NOT MERGE - fix memory leak in PatchPanel Before the audio patch is created, audio patch with same handle is removed from vector for patches. At this time, Patch allocated in the heap is not freed. This causes memory leaks in the mediaserver. Bug: 18904322. Change-Id: Id0d28c36a7e7fbf473753bf4ead7518f28c1b998 --- services/audioflinger/PatchPanel.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'services/audioflinger') diff --git a/services/audioflinger/PatchPanel.cpp b/services/audioflinger/PatchPanel.cpp index 7544052..4f0c6b1 100644 --- a/services/audioflinger/PatchPanel.cpp +++ b/services/audioflinger/PatchPanel.cpp @@ -166,7 +166,9 @@ status_t AudioFlinger::PatchPanel::createAudioPatch(const struct audio_patch *pa if (*handle == mPatches[index]->mHandle) { ALOGV("createAudioPatch() removing patch handle %d", *handle); halHandle = mPatches[index]->mHalHandle; + Patch *removedPatch = mPatches[index]; mPatches.removeAt(index); + delete removedPatch; break; } } -- cgit v1.1