Fix some memory leaks
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
be9b5d1612
commit
2a8c80557f
4 changed files with 17 additions and 9 deletions
|
@ -92,9 +92,8 @@ void Font::loadFile(const std::string& filename, NVGcontext* vg) {
|
|||
// Transfer ownership of font data to font object
|
||||
uint8_t* data = system::readFile(filename, &size);
|
||||
// Don't use nvgCreateFont because it doesn't properly handle UTF-8 filenames on Windows.
|
||||
handle = nvgCreateFontMem(vg, name.c_str(), data, size, 0);
|
||||
handle = nvgCreateFontMem(vg, name.c_str(), data, size, 1);
|
||||
if (handle < 0) {
|
||||
std::free(data);
|
||||
throw Exception("Failed to load font %s", filename.c_str());
|
||||
}
|
||||
INFO("Loaded font %s", filename.c_str());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue