1
0
forked from GitHub/gf-core

textdup is now safe in case of memory overflow

This commit is contained in:
krangelov
2021-08-27 13:03:11 +02:00
parent 5271ddd10b
commit 41ef5f9539

View File

@@ -21,7 +21,8 @@ PgfText* textdup(PgfText *t1)
{
size_t size = sizeof(PgfText)+t1->size+1;
PgfText *t2 = (PgfText *) malloc(size);
memcpy(t2, t1, size);
if (t2 != NULL)
memcpy(t2, t1, size);
return t2;
}