Don't crash in FcPatternFormat() with NULL pattern
This commit is contained in:
parent
c9581b47c4
commit
8198127b25
|
@ -1193,15 +1193,19 @@ FcPatternFormat (FcPattern *pat,
|
||||||
{
|
{
|
||||||
FcStrBuf buf;
|
FcStrBuf buf;
|
||||||
FcChar8 buf_static[8192 - 1024];
|
FcChar8 buf_static[8192 - 1024];
|
||||||
|
FcPattern *alloced = NULL;
|
||||||
FcBool ret;
|
FcBool ret;
|
||||||
|
|
||||||
if (!pat)
|
if (!pat)
|
||||||
return NULL;
|
alloced = pat = FcPatternCreate ();
|
||||||
|
|
||||||
FcStrBufInit (&buf, buf_static, sizeof (buf_static));
|
FcStrBufInit (&buf, buf_static, sizeof (buf_static));
|
||||||
|
|
||||||
ret = FcPatternFormatToBuf (pat, format, &buf);
|
ret = FcPatternFormatToBuf (pat, format, &buf);
|
||||||
|
|
||||||
|
if (alloced)
|
||||||
|
FcPatternDestroy (alloced);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return FcStrBufDone (&buf);
|
return FcStrBufDone (&buf);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue