[wasm-graphite] Memory hygiene
This commit is contained in:
parent
faaae04359
commit
8215e70632
|
@ -117,7 +117,11 @@ shape (void *shape_plan,
|
||||||
cluster_t *clusters = (cluster_t *) malloc (length * sizeof (cluster_t));
|
cluster_t *clusters = (cluster_t *) malloc (length * sizeof (cluster_t));
|
||||||
uint32_t *gids = (uint32_t *) malloc (length * sizeof (uint32_t));
|
uint32_t *gids = (uint32_t *) malloc (length * sizeof (uint32_t));
|
||||||
if (!clusters || !gids)
|
if (!clusters || !gids)
|
||||||
|
{
|
||||||
|
free (clusters);
|
||||||
|
free (gids);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
memset (clusters, 0, sizeof (clusters[0]) * length);
|
memset (clusters, 0, sizeof (clusters[0]) * length);
|
||||||
codepoint_t *pg = gids;
|
codepoint_t *pg = gids;
|
||||||
|
|
Loading…
Reference in New Issue