Fix memory leak not freeing stb_decode ptr
This commit is contained in:
		
							parent
							
								
									4c38abc672
								
							
						
					
					
						commit
						da07ce3f75
					
				| @ -266,6 +266,7 @@ INTERNAL i32 initRendererForPlayback(MemoryArena *arena, | ||||
| 	return result; | ||||
| } | ||||
| 
 | ||||
| #include <stdlib.h> | ||||
| const i32 audio_playVorbis(MemoryArena *arena, AudioManager *audioManager, | ||||
|                            AudioRenderer *audioRenderer, AudioVorbis *vorbis, | ||||
|                            i32 numPlays) | ||||
| @ -281,6 +282,10 @@ const i32 audio_playVorbis(MemoryArena *arena, AudioManager *audioManager, | ||||
| 	             soundSamples, numSamples * vorbis->info.channels * sizeof(i16), | ||||
| 	             vorbis->info.sample_rate); | ||||
| 
 | ||||
| 	// NOTE(doyle): stb_vorbis specific implementation requires free()
 | ||||
| 	// TODO(doyle): Object pool this and use our malloc to avoid dependency in Audio.c
 | ||||
| 	free(soundSamples); | ||||
| 
 | ||||
| 	audioRenderer->audio       = vorbis; | ||||
| 	audioRenderer->isStreaming = FALSE; | ||||
| 	audioRenderer->state       = audiostate_playing; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user