Fix uninitialized memory with sndfile
This commit is contained in:
parent
af21c5775d
commit
afba7e4bc7
1 changed files with 3 additions and 0 deletions
|
|
@ -12,6 +12,7 @@
|
||||||
#endif
|
#endif
|
||||||
#include <sndfile.h>
|
#include <sndfile.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
struct st_audio_file {
|
struct st_audio_file {
|
||||||
SNDFILE* snd;
|
SNDFILE* snd;
|
||||||
|
|
@ -24,6 +25,8 @@ st_audio_file* st_open_file(const char* filename)
|
||||||
if (!af)
|
if (!af)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
memset(&af->info, 0, sizeof(SF_INFO));
|
||||||
|
|
||||||
af->snd = sf_open(filename, SFM_READ, &af->info);
|
af->snd = sf_open(filename, SFM_READ, &af->info);
|
||||||
if (!af->snd) {
|
if (!af->snd) {
|
||||||
free(af);
|
free(af);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue