Merge "AudioFlinger: update error handling moveEffectChain_l"
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 733fea4..148cfa6 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -4121,6 +4121,8 @@
     size_t restored = 0;
     if (status != NO_ERROR) {
         for (const auto& effect : removed) {
+            dstThread->removeEffect_l(effect); // Note: Depending on error location, the last
+                                               // effect may not have been placed on dstThread.
             if (srcThread->addEffect_l(effect) == NO_ERROR) {
                 ++restored;
             }