Increase the refcount in FcConfigSetCurrent()
https://bugs.freedesktop.org/show_bug.cgi?id=82432
This commit is contained in:
parent
841753a93f
commit
23e88d8c6a
|
@ -298,6 +298,7 @@ main (int argc, char **argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
FcConfigSetCurrent (config);
|
FcConfigSetCurrent (config);
|
||||||
|
FcConfigDestroy (config);
|
||||||
|
|
||||||
args = FcStrSetCreate ();
|
args = FcStrSetCreate ();
|
||||||
if (!args)
|
if (!args)
|
||||||
|
|
|
@ -434,6 +434,7 @@ retry:
|
||||||
if (!fc_atomic_ptr_cmpexch (&_fcConfig, cfg, config))
|
if (!fc_atomic_ptr_cmpexch (&_fcConfig, cfg, config))
|
||||||
goto retry;
|
goto retry;
|
||||||
|
|
||||||
|
FcConfigReference (config);
|
||||||
if (cfg)
|
if (cfg)
|
||||||
FcConfigDestroy (cfg);
|
FcConfigDestroy (cfg);
|
||||||
|
|
||||||
|
@ -2405,6 +2406,10 @@ FcConfigSetSysRoot (FcConfig *config,
|
||||||
{
|
{
|
||||||
config = FcInitLoadOwnConfigAndFonts (config);
|
config = FcInitLoadOwnConfigAndFonts (config);
|
||||||
FcConfigSetCurrent (config);
|
FcConfigSetCurrent (config);
|
||||||
|
/* FcConfigSetCurrent() increases the refcount.
|
||||||
|
* decrease it here to avoid the memory leak.
|
||||||
|
*/
|
||||||
|
FcConfigDestroy (config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -189,11 +189,18 @@ FcBool
|
||||||
FcInitReinitialize (void)
|
FcInitReinitialize (void)
|
||||||
{
|
{
|
||||||
FcConfig *config;
|
FcConfig *config;
|
||||||
|
FcBool ret;
|
||||||
|
|
||||||
config = FcInitLoadConfigAndFonts ();
|
config = FcInitLoadConfigAndFonts ();
|
||||||
if (!config)
|
if (!config)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
return FcConfigSetCurrent (config);
|
ret = FcConfigSetCurrent (config);
|
||||||
|
/* FcConfigSetCurrent() increases the refcount.
|
||||||
|
* decrease it here to avoid the memory leak.
|
||||||
|
*/
|
||||||
|
FcConfigDestroy (config);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
|
|
Loading…
Reference in New Issue