diff mbox series

[13/15] checkpolicy: free temporary bounds type

Message ID 20240122135507.63506-13-cgzones@googlemail.com (mailing list archive)
State Accepted
Commit 63207ce82e8e
Delegated to: Petr Lautrbach
Headers show
Series [01/15] checkpolicy: add libfuzz based fuzzer | expand

Commit Message

Christian Göttsche Jan. 22, 2024, 1:55 p.m. UTC
Free the temporary bounds type in the error branches.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 checkpolicy/module_compiler.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

James Carter Feb. 13, 2024, 8:38 p.m. UTC | #1
On Mon, Jan 22, 2024 at 9:02 AM Christian Göttsche
<cgzones@googlemail.com> wrote:
>
> Free the temporary bounds type in the error branches.
>
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>

Acked-by: James Carter <jwcart2@gmail.com>

> ---
>  checkpolicy/module_compiler.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/checkpolicy/module_compiler.c b/checkpolicy/module_compiler.c
> index 119b7e36..464897cc 100644
> --- a/checkpolicy/module_compiler.c
> +++ b/checkpolicy/module_compiler.c
> @@ -234,6 +234,7 @@ static int role_implicit_bounds(hashtab_t roles_tab,
>         if (!bounds) {
>                 yyerror2("role %s doesn't exist, is implicit bounds of %s",
>                          bounds_id, role_id);
> +               free(bounds_id);
>                 return -1;
>         }
>
> @@ -243,6 +244,7 @@ static int role_implicit_bounds(hashtab_t roles_tab,
>                 yyerror2("role %s has inconsistent bounds %s/%s",
>                          role_id, bounds_id,
>                          policydbp->p_role_val_to_name[role->bounds - 1]);
> +               free(bounds_id);
>                 return -1;
>         }
>         free(bounds_id);
> @@ -479,6 +481,7 @@ static int user_implicit_bounds(hashtab_t users_tab,
>         if (!bounds) {
>                 yyerror2("user %s doesn't exist, is implicit bounds of %s",
>                          bounds_id, user_id);
> +               free(bounds_id);
>                 return -1;
>         }
>
> @@ -488,6 +491,7 @@ static int user_implicit_bounds(hashtab_t users_tab,
>                 yyerror2("user %s has inconsistent bounds %s/%s",
>                          user_id, bounds_id,
>                          policydbp->p_role_val_to_name[user->bounds - 1]);
> +               free(bounds_id);
>                 return -1;
>         }
>         free(bounds_id);
> --
> 2.43.0
>
>
James Carter March 4, 2024, 7:20 p.m. UTC | #2
On Tue, Feb 13, 2024 at 3:38 PM James Carter <jwcart2@gmail.com> wrote:
>
> On Mon, Jan 22, 2024 at 9:02 AM Christian Göttsche
> <cgzones@googlemail.com> wrote:
> >
> > Free the temporary bounds type in the error branches.
> >
> > Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
>
> Acked-by: James Carter <jwcart2@gmail.com>
>
Merged.
Thanks,
Jim

> > ---
> >  checkpolicy/module_compiler.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/checkpolicy/module_compiler.c b/checkpolicy/module_compiler.c
> > index 119b7e36..464897cc 100644
> > --- a/checkpolicy/module_compiler.c
> > +++ b/checkpolicy/module_compiler.c
> > @@ -234,6 +234,7 @@ static int role_implicit_bounds(hashtab_t roles_tab,
> >         if (!bounds) {
> >                 yyerror2("role %s doesn't exist, is implicit bounds of %s",
> >                          bounds_id, role_id);
> > +               free(bounds_id);
> >                 return -1;
> >         }
> >
> > @@ -243,6 +244,7 @@ static int role_implicit_bounds(hashtab_t roles_tab,
> >                 yyerror2("role %s has inconsistent bounds %s/%s",
> >                          role_id, bounds_id,
> >                          policydbp->p_role_val_to_name[role->bounds - 1]);
> > +               free(bounds_id);
> >                 return -1;
> >         }
> >         free(bounds_id);
> > @@ -479,6 +481,7 @@ static int user_implicit_bounds(hashtab_t users_tab,
> >         if (!bounds) {
> >                 yyerror2("user %s doesn't exist, is implicit bounds of %s",
> >                          bounds_id, user_id);
> > +               free(bounds_id);
> >                 return -1;
> >         }
> >
> > @@ -488,6 +491,7 @@ static int user_implicit_bounds(hashtab_t users_tab,
> >                 yyerror2("user %s has inconsistent bounds %s/%s",
> >                          user_id, bounds_id,
> >                          policydbp->p_role_val_to_name[user->bounds - 1]);
> > +               free(bounds_id);
> >                 return -1;
> >         }
> >         free(bounds_id);
> > --
> > 2.43.0
> >
> >
diff mbox series

Patch

diff --git a/checkpolicy/module_compiler.c b/checkpolicy/module_compiler.c
index 119b7e36..464897cc 100644
--- a/checkpolicy/module_compiler.c
+++ b/checkpolicy/module_compiler.c
@@ -234,6 +234,7 @@  static int role_implicit_bounds(hashtab_t roles_tab,
 	if (!bounds) {
 		yyerror2("role %s doesn't exist, is implicit bounds of %s",
 			 bounds_id, role_id);
+		free(bounds_id);
 		return -1;
 	}
 
@@ -243,6 +244,7 @@  static int role_implicit_bounds(hashtab_t roles_tab,
 		yyerror2("role %s has inconsistent bounds %s/%s",
 			 role_id, bounds_id,
 			 policydbp->p_role_val_to_name[role->bounds - 1]);
+		free(bounds_id);
 		return -1;
 	}
 	free(bounds_id);
@@ -479,6 +481,7 @@  static int user_implicit_bounds(hashtab_t users_tab,
 	if (!bounds) {
 		yyerror2("user %s doesn't exist, is implicit bounds of %s",
 			 bounds_id, user_id);
+		free(bounds_id);
 		return -1;
 	}
 
@@ -488,6 +491,7 @@  static int user_implicit_bounds(hashtab_t users_tab,
 		yyerror2("user %s has inconsistent bounds %s/%s",
 			 user_id, bounds_id,
 			 policydbp->p_role_val_to_name[user->bounds - 1]);
+		free(bounds_id);
 		return -1;
 	}
 	free(bounds_id);