Imported Upstream version 2.13.1
[platform/upstream/fontconfig.git] / src / fcstr.c
index b65492d..4247c85 100644 (file)
@@ -867,6 +867,17 @@ FcStrUsesHome (const FcChar8 *s)
     return *s == '~';
 }
 
+FcBool
+FcStrIsAbsoluteFilename (const FcChar8 *s)
+{
+#ifdef _WIN32
+    if (*s == '\\' ||
+       (isalpha (*s) && s[1] == ':' && (s[2] == '/' || s[2] == '\\')))
+       return FcTrue;
+#endif
+    return *s == '/';
+}
+
 FcChar8 *
 FcStrBuildFilename (const FcChar8 *path,
                    ...)
@@ -942,7 +953,7 @@ FcStrCopyFilename (const FcChar8 *s)
        if (!home)
            return NULL;
        size = strlen ((char *) home) + strlen ((char *) s);
-       full = (FcChar8 *) malloc (size);
+       full = (FcChar8 *) malloc (size + 1);
        if (!full)
            return NULL;
        strcpy ((char *) full, (char *) home);