Fix Source memory leak;

This commit is contained in:
bjorn 2017-01-06 19:15:03 -08:00
parent 33a34b60b1
commit 1e2294a345
2 changed files with 3 additions and 0 deletions

View File

@ -20,6 +20,7 @@ typedef struct {
int bufferSize;
void* buffer;
void* decoder;
void* data;
} SourceData;
typedef struct {

View File

@ -22,12 +22,14 @@ SourceData* lovrSourceDataFromFile(void* data, int size) {
sourceData->decoder = decoder;
sourceData->bufferSize = sourceData->channels * 4096 * sizeof(short);
sourceData->buffer = malloc(sourceData->bufferSize);
sourceData->data = data;
return sourceData;
}
void lovrSourceDataDestroy(SourceData* sourceData) {
stb_vorbis_close(sourceData->decoder);
free(sourceData->data);
free(sourceData->buffer);
free(sourceData);
}