Re: [PATCH 3/3] mcstrans: free constraint in error branch

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

 



On Mon, Apr 29, 2024 at 11:52 AM Christian Göttsche
<cgoettsche@xxxxxxxxxxxxx> wrote:
>
> From: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>
>
> Free constraint, like in all other error branches.
>
> Reported-by: Cppcheck
> Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>
> ---
>  mcstrans/src/mcstrans.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/mcstrans/src/mcstrans.c b/mcstrans/src/mcstrans.c
> index fded3235..7667e131 100644
> --- a/mcstrans/src/mcstrans.c
> +++ b/mcstrans/src/mcstrans.c
> @@ -477,6 +477,7 @@ add_constraint(char op, char *raw, char *tok) {
>                 }
>                 if (asprintf(&constraint->text, "%s%c%s", raw, op, tok) < 0) {
>                         log_error("asprintf failed %s", strerror(errno));
> +                       free(constraint);
>                         return -1;
>                 }
>                 constraint->op = op;
> --
> 2.43.0
>

Ack, but this code could be cleaned up to use a common error label. I think
that would clean this code up a lot.

>





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

  Powered by Linux