mirror of https://github.com/bjornbytes/lovr.git
Fix Source memory leak;
This commit is contained in:
parent
33a34b60b1
commit
1e2294a345
|
@ -20,6 +20,7 @@ typedef struct {
|
|||
int bufferSize;
|
||||
void* buffer;
|
||||
void* decoder;
|
||||
void* data;
|
||||
} SourceData;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue