Replace a couple of malloc()s with calloc()
This commit is contained in:
parent
26ba4d1e1f
commit
a5efaac4ff
|
@ -113,7 +113,7 @@ _hb_face_for_data_closure_create (hb_blob_t *blob, unsigned int index)
|
||||||
{
|
{
|
||||||
hb_face_for_data_closure_t *closure;
|
hb_face_for_data_closure_t *closure;
|
||||||
|
|
||||||
closure = (hb_face_for_data_closure_t *) malloc (sizeof (hb_face_for_data_closure_t));
|
closure = (hb_face_for_data_closure_t *) calloc (1, sizeof (hb_face_for_data_closure_t));
|
||||||
if (unlikely (!closure))
|
if (unlikely (!closure))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ hb_shape_plan_create (hb_face_t *face,
|
||||||
face = hb_face_get_empty ();
|
face = hb_face_get_empty ();
|
||||||
if (unlikely (!props))
|
if (unlikely (!props))
|
||||||
return hb_shape_plan_get_empty ();
|
return hb_shape_plan_get_empty ();
|
||||||
if (num_user_features && !(features = (hb_feature_t *) malloc (num_user_features * sizeof (hb_feature_t))))
|
if (num_user_features && !(features = (hb_feature_t *) calloc (num_user_features, sizeof (hb_feature_t))))
|
||||||
return hb_shape_plan_get_empty ();
|
return hb_shape_plan_get_empty ();
|
||||||
if (!(shape_plan = hb_object_create<hb_shape_plan_t> ())) {
|
if (!(shape_plan = hb_object_create<hb_shape_plan_t> ())) {
|
||||||
free (features);
|
free (features);
|
||||||
|
|
|
@ -64,7 +64,7 @@ retry:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Not found; allocate one. */
|
/* Not found; allocate one. */
|
||||||
shapers = (hb_shaper_pair_t *) malloc (sizeof (all_shapers));
|
shapers = (hb_shaper_pair_t *) calloc (1, sizeof (all_shapers));
|
||||||
if (unlikely (!shapers)) {
|
if (unlikely (!shapers)) {
|
||||||
(void) hb_atomic_ptr_cmpexch (&static_shapers, NULL, &all_shapers[0]);
|
(void) hb_atomic_ptr_cmpexch (&static_shapers, NULL, &all_shapers[0]);
|
||||||
return (const hb_shaper_pair_t *) all_shapers;
|
return (const hb_shaper_pair_t *) all_shapers;
|
||||||
|
|
Loading…
Reference in New Issue