From d8cd47792bac11a44096ef8233bb5268a6674bec Mon Sep 17 00:00:00 2001 From: "soon1.choi" Date: Mon, 5 Jan 2015 14:27:42 +0900 Subject: 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. 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