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;
|
||||
}
|
||||
FcConfigSetCurrent (config);
|
||||
FcConfigDestroy (config);
|
||||
|
||||
args = FcStrSetCreate ();
|
||||
if (!args)
|
||||
|
|
|
@ -434,6 +434,7 @@ retry:
|
|||
if (!fc_atomic_ptr_cmpexch (&_fcConfig, cfg, config))
|
||||
goto retry;
|
||||
|
||||
FcConfigReference (config);
|
||||
if (cfg)
|
||||
FcConfigDestroy (cfg);
|
||||
|
||||
|
@ -2405,6 +2406,10 @@ FcConfigSetSysRoot (FcConfig *config,
|
|||
{
|
||||
config = FcInitLoadOwnConfigAndFonts (config);
|
||||
FcConfigSetCurrent (config);
|
||||
/* FcConfigSetCurrent() increases the refcount.
|
||||
* decrease it here to avoid the memory leak.
|
||||
*/
|
||||
FcConfigDestroy (config);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -189,11 +189,18 @@ FcBool
|
|||
FcInitReinitialize (void)
|
||||
{
|
||||
FcConfig *config;
|
||||
FcBool ret;
|
||||
|
||||
config = FcInitLoadConfigAndFonts ();
|
||||
if (!config)
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue