Browse Source

Fix memory leak when accessing/listing system fonts.

bruvzg 3 years ago
parent
commit
6510e11ae9
1 changed files with 3 additions and 0 deletions
  1. 3 0
      platform/linuxbsd/os_linuxbsd.cpp

+ 3 - 0
platform/linuxbsd/os_linuxbsd.cpp

@@ -368,6 +368,7 @@ Vector<String> OS_LinuxBSD::get_system_fonts() const {
 		FcPatternDestroy(pattern);
 		FcPatternDestroy(pattern);
 	}
 	}
 	FcObjectSetDestroy(object_set);
 	FcObjectSetDestroy(object_set);
+	FcConfigDestroy(config);
 
 
 	for (const String &E : font_names) {
 	for (const String &E : font_names) {
 		ret.push_back(E);
 		ret.push_back(E);
@@ -417,6 +418,8 @@ String OS_LinuxBSD::get_system_font_path(const String &p_font_name, bool p_bold,
 		FcPatternDestroy(pattern);
 		FcPatternDestroy(pattern);
 	}
 	}
 	FcObjectSetDestroy(object_set);
 	FcObjectSetDestroy(object_set);
+	FcConfigDestroy(config);
+
 	return ret;
 	return ret;
 #else
 #else
 	ERR_FAIL_V_MSG(String(), "Godot was compiled without fontconfig, system font support is disabled.");
 	ERR_FAIL_V_MSG(String(), "Godot was compiled without fontconfig, system font support is disabled.");