[PATCH 3/3] utilities: kernelscan: swap calloc arguments in unget_next()

Keng-Yu Lin kengyu at canonical.com
Thu Nov 22 06:09:33 UTC 2012


On Fri, Nov 16, 2012 at 4:32 PM, Colin King <colin.king at canonical.com> wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> In unget_next() we should be allocating 1 lot of get_stack sized
> memory rather than get_stack sized lots of bytes. Not that it makes
> much difference, but fix the order anyhow.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  src/utilities/kernelscan.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/utilities/kernelscan.c b/src/utilities/kernelscan.c
> index 7b12f83..d966f03 100644
> --- a/src/utilities/kernelscan.c
> +++ b/src/utilities/kernelscan.c
> @@ -147,7 +147,7 @@ static void unget_next(parser *p, int ch)
>  {
>         get_stack *new;
>
> -       if ((new = calloc(sizeof(get_stack), 1)) == NULL) {
> +       if ((new = calloc(1, sizeof(get_stack))) == NULL) {
>                 fprintf(stderr, "unget_next: Out of memory!\n");
>                 exit(EXIT_FAILURE);
>         }
> --
> 1.7.10.4
>
Acked-by: Keng-Yu Lin <kengyu at canonical.com>



More information about the fwts-devel mailing list