Signed-off-by: Sandeep Patil <sspatil@xxxxxxxxxx> --- libselinux/src/label_backends_android.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libselinux/src/label_backends_android.c b/libselinux/src/label_backends_android.c index 4d6ec86..6442104 100644 --- a/libselinux/src/label_backends_android.c +++ b/libselinux/src/label_backends_android.c @@ -200,10 +200,9 @@ static int init(struct selabel_handle *rec, const struct selinux_opt *opts, } if (NULL == (data->spec_arr = - malloc(sizeof(spec_t) * data->nspec))) + calloc(data->nspec, sizeof(spec_t)))) goto finish; - memset(data->spec_arr, 0, sizeof(spec_t) * data->nspec); maxnspec = data->nspec; rewind(fp); } @@ -322,10 +321,9 @@ int selabel_property_init(struct selabel_handle *rec, { struct saved_data *data; - data = (struct saved_data *)malloc(sizeof(*data)); + data = (struct saved_data *)calloc(1, sizeof(*data)); if (!data) return -1; - memset(data, 0, sizeof(*data)); rec->data = data; rec->func_close = &closef; @@ -340,10 +338,9 @@ int selabel_service_init(struct selabel_handle *rec, { struct saved_data *data; - data = (struct saved_data *)malloc(sizeof(*data)); + data = (struct saved_data *)calloc(1, sizeof(*data)); if (!data) return -1; - memset(data, 0, sizeof(*data)); rec->data = data; rec->func_close = &closef; -- 2.11.0.483.g087da7b7c-goog _______________________________________________ Selinux mailing list Selinux@xxxxxxxxxxxxx To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx. To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.