Re: [PATCH 04/15] checkpolicy: free ebitmap on error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 22, 2024 at 9:02 AM Christian Göttsche
<cgzones@xxxxxxxxxxxxxx> wrote:
>
> Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>

Acked-by: James Carter <jwcart2@xxxxxxxxx>

> ---
>  checkpolicy/policy_define.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c
> index db7e9d0e..053156df 100644
> --- a/checkpolicy/policy_define.c
> +++ b/checkpolicy/policy_define.c
> @@ -2544,6 +2544,8 @@ static int define_te_avtab_helper(int which, avrule_t ** rule)
>         int add = 1, ret = 0;
>         int suppress = 0;
>
> +       ebitmap_init(&tclasses);
> +
>         avrule = (avrule_t *) malloc(sizeof(avrule_t));
>         if (!avrule) {
>                 yyerror("memory error");
> @@ -2607,7 +2609,6 @@ static int define_te_avtab_helper(int which, avrule_t ** rule)
>                 }
>         }
>
> -       ebitmap_init(&tclasses);
>         ret = read_classes(&tclasses);
>         if (ret)
>                 goto out;
> @@ -2693,8 +2694,6 @@ static int define_te_avtab_helper(int which, avrule_t ** rule)
>                 free(id);
>         }
>
> -       ebitmap_destroy(&tclasses);
> -
>         avrule->perms = perms;
>         *rule = avrule;
>
> @@ -2703,6 +2702,9 @@ static int define_te_avtab_helper(int which, avrule_t ** rule)
>                 avrule_destroy(avrule);
>                 free(avrule);
>         }
> +
> +       ebitmap_destroy(&tclasses);
> +
>         return ret;
>
>  }
> --
> 2.43.0
>
>





[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux