[wasm-graphite] Memory hygiene

This commit is contained in:
Behdad Esfahbod committed 2023-03-31 17:33:45 -06:00
1 parent faaae04359
commit 8215e70632
1 file changed
+4
+4
View File
@@ -117,7 +117,11 @@ shape (void *shape_plan,
cluster_t *clusters = (cluster_t *) malloc (length * sizeof (cluster_t));
uint32_t *gids = (uint32_t *) malloc (length * sizeof (uint32_t));
if (!clusters || !gids)
{
free (clusters);
free (gids);
return false;
}
memset (clusters, 0, sizeof (clusters[0]) * length);
codepoint_t *pg = gids;