Re: [PATCH] libsepol: free potential transition tables on insertion failure

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

 



On Fri, Jul 14, 2023 at 3:04 PM Christian Göttsche
<cgzones@xxxxxxxxxxxxxx> wrote:
>
> If the insertion via the callback insertf fails, free the potential
> previously allocated transition hashtables.
>
> Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>
> ---
>  libsepol/src/avtab.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/libsepol/src/avtab.c b/libsepol/src/avtab.c
> index 99fdaa87..6c74eff7 100644
> --- a/libsepol/src/avtab.c
> +++ b/libsepol/src/avtab.c
> @@ -715,7 +715,12 @@ int avtab_read_item(struct policy_file *fp, uint32_t vers, avtab_t * a,
>                 }
>                 datum.data = le32_to_cpu(*buf32);
>         }
> -       return insertf(a, &key, &datum, p);
> +
> +       rc = insertf(a, &key, &datum, p);
> +       if (rc < 0)
> +               avtab_trans_destroy(&trans);
> +
> +       return rc;
>  }
>
>  static int avtab_insertf(avtab_t * a, avtab_key_t * k, avtab_datum_t * d,
> --
> 2.40.1
>

This patch depended on the prefix/suffix patches which have been reverted.
Jim




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

  Powered by Linux