Merge pull request #565 from jpcima/st-audiofile-fix

Fix uninitialized memory with sndfile
This commit is contained in:
JP Cimalando 2020-11-24 20:56:45 +01:00 committed by GitHub
commit 9142aaed7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,6 +12,7 @@
#endif
#include <sndfile.h>
#include <stdlib.h>
#include <string.h>
struct st_audio_file {
SNDFILE* snd;
@ -24,6 +25,8 @@ st_audio_file* st_open_file(const char* filename)
if (!af)
return NULL;
memset(&af->info, 0, sizeof(SF_INFO));
af->snd = sf_open(filename, SFM_READ, &af->info);
if (!af->snd) {
free(af);