Skip to content

Commit 58975dd

Browse files
authored
Fixing a memory leak from not deallocating audio data pointer (#38)
* Fixing a memory leak from not deallocating audio data pointer * Moved the deallocation of theData to the end * cleaned up unneeded deallocation in 164
1 parent 35353b3 commit 58975dd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Sources/SoundpipeAudioKit/Generators/PhaseLockedVocoder.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,11 @@ public class PhaseLockedVocoder: Node {
160160
au.setWavetable(data: data, size: Int(ioNumberFrames))
161161
} else {
162162
// failure
163-
theData?.deallocate()
164-
theData = nil // make sure to return NULL
165163
Log("Error = \(err)"); break Exit
166164
}
165+
// Fixing a previous memory leak
166+
theData?.deallocate()
167+
theData = nil
167168
}
168169
}
169170
}

0 commit comments

Comments
 (0)