On Thu, 2017-01-12 at 21:20 -0800, Sandeep Patil wrote:
> Signed-off-by: Sandeep Patil <sspa...@google.com>

Thanks, applied.

> ---
>  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;
_______________________________________________
Selinux mailing list
Selinux@tycho.nsa.gov
To unsubscribe, send email to selinux-le...@tycho.nsa.gov.
To get help, send an email containing "help" to selinux-requ...@tycho.nsa.gov.

Reply via email to