mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 05:35:35 +00:00
Merge pull request #35 from michaelDCurran/loadSpectSeq_fclose
Stop leaking file streams in libespeak-ng's LoadSpectSeq function.
This commit is contained in:
@@ -339,6 +339,7 @@ int LoadSpectSeq(SpectSeq *spect, const char *filename)
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Unsupported spectral file format.\n");
|
||||
fclose(stream);
|
||||
return(1);
|
||||
}
|
||||
|
||||
@@ -356,7 +357,11 @@ int LoadSpectSeq(SpectSeq *spect, const char *filename)
|
||||
fread(&spect->max_y,sizeof(short),1,stream);
|
||||
fread(&temp,sizeof(short),1,stream); // unused
|
||||
|
||||
if(n==0) return(0);
|
||||
if(n==0)
|
||||
{
|
||||
fclose(stream);
|
||||
return(0);
|
||||
}
|
||||
|
||||
if(spect->frames != NULL)
|
||||
{
|
||||
@@ -417,5 +422,6 @@ int LoadSpectSeq(SpectSeq *spect, const char *filename)
|
||||
if(spect->frames[ix]->keyframe)
|
||||
spect->frames[ix]->length_adjust = spect->frames[ix]->length - GetFrameLength(spect,ix);
|
||||
}
|
||||
fclose(stream);
|
||||
return(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user