Fix possibly dereferencing a null pointer

This commit is contained in:
Akira TAGOH 2018-07-19 08:31:14 +00:00
parent 8e97d745cc
commit b1762935c3
1 changed files with 8 additions and 5 deletions

View File

@ -814,11 +814,14 @@ FcFontSetMatchInternal (FcFontSet **sets,
len = (p - s); len = (p - s);
} }
x = malloc (sizeof (char) * (len + 1)); x = malloc (sizeof (char) * (len + 1));
strcpy (x, s); if (x)
if (FcObjectFromName (x) > 0) {
FcObjectSetAdd (os, x); strcpy (x, s);
s = p + 1; if (FcObjectFromName (x) > 0)
free (x); FcObjectSetAdd (os, x);
s = p + 1;
free (x);
}
} }
free (ss); free (ss);
} }