Fix memory leak when resolving named instances in fonts
We need to free the memory allocated when getting the info about the variable font. Change-Id: I25c5f070a6d02468c904428ea2ae71efce1e847c Reviewed-by: Lars Knoll <lars@knoll.priv.no>
This commit is contained in:
parent
3bae65e7d6
commit
c22ff83b2a
@ -107,6 +107,10 @@ void QFreeTypeFontDatabase::addNamedInstancesForFace(void *face_,
|
|||||||
FT_MM_Var *var = nullptr;
|
FT_MM_Var *var = nullptr;
|
||||||
FT_Get_MM_Var(face, &var);
|
FT_Get_MM_Var(face, &var);
|
||||||
if (var != nullptr) {
|
if (var != nullptr) {
|
||||||
|
std::unique_ptr<FT_MM_Var, void(*)(FT_MM_Var*)> varGuard(var, [](FT_MM_Var *res) {
|
||||||
|
FT_Done_MM_Var(qt_getFreetype(), res);
|
||||||
|
});
|
||||||
|
|
||||||
for (FT_UInt i = 0; i < var->num_namedstyles; ++i) {
|
for (FT_UInt i = 0; i < var->num_namedstyles; ++i) {
|
||||||
FT_UInt id = var->namedstyle[i].strid;
|
FT_UInt id = var->namedstyle[i].strid;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user