[PATCH] record: move free() to after last use of pContext

Jamey Sharp jamey at minilop.net
Sat Jun 5 00:35:28 PDT 2010


I saw that one too and came to the same conclusion, but didn't
actually write the patch. So:
Reviewed-by: Jamey Sharp <jamey at minilop.net>


On 6/4/10, Matt Turner <mattst88 at gmail.com> wrote:
> No functional change, since free doesn't change the value of the pointer
> passed to it, but it makes this code less confusing.
>
> Signed-off-by: Matt Turner <mattst88 at gmail.com>
> ---
> Alan, I saw this when looking through your parfait results.
>
> It looks like RecordFindContextOnAllContexts's argument should be marked
> const also.
>
>  record/record.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/record/record.c b/record/record.c
> index 46231c9..bfc95bb 100644
> --- a/record/record.c
> +++ b/record/record.c
> @@ -2522,8 +2522,6 @@ RecordDeleteContext(pointer value, XID id)
>  	}
>      }
>
> -    free(pContext);
> -
>      /* remove context from AllContexts list */
>
>      if (-1 != (i = RecordFindContextOnAllContexts(pContext)))
> @@ -2535,6 +2533,8 @@ RecordDeleteContext(pointer value, XID id)
>  	    ppAllContexts = NULL;
>  	}
>      }
> +    free(pContext);
> +
>      return Success;
>  } /* RecordDeleteContext */
>
> --
> 1.6.4.4
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>


More information about the xorg-devel mailing list