On Sun, Apr 22, 2018 at 12:21 PM, Nicolas Iooss <[email protected]> wrote:
> clang's static analyzer reports a potential memory leak because the
> buffers allocated in pc and fc are not freed in main(), in sestatus.c.
> Free these buffers properly.
>
> Signed-off-by: Nicolas Iooss <[email protected]>
> ---
>  policycoreutils/sestatus/sestatus.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/policycoreutils/sestatus/sestatus.c 
> b/policycoreutils/sestatus/sestatus.c
> index d7f198c2fa0d..9a92e72ff4fd 100644
> --- a/policycoreutils/sestatus/sestatus.c
> +++ b/policycoreutils/sestatus/sestatus.c
> @@ -436,6 +436,7 @@ int main(int argc, char **argv)
>                         printf("%s\n", context);
>                         freecon(context);
>                 }
> +               free(pc[i]);
>         }
>
>         printf("\nFile contexts:\n");
> @@ -478,6 +479,7 @@ int main(int argc, char **argv)
>                                 freecon(context);
>                         }
>                 }
> +               free(fc[i]);
>         }
>
>         return 0;
> --
> 2.17.0
>
>
ack on both patches in this series.

Reply via email to