tvg_saver: +exception handling

close the file handle before returning the function.
This commit is contained in:
Hermet Park 2021-07-26 16:17:06 +09:00
parent 18f4b96786
commit 5e3011f86e

View file

@ -42,7 +42,10 @@ bool TvgSaver::flushTo(const std::string& path)
FILE* fp = fopen(path.c_str(), "w+");
if (!fp) return false;
if (fwrite(buffer.data, sizeof(char), buffer.count, fp) == 0) return false;
if (fwrite(buffer.data, sizeof(char), buffer.count, fp) == 0) {
fclose(fp);
return false;
}
fclose(fp);