On 11/04/2016 08:13 PM, Ian Jackson wrote:
> collapse_slashes always returns a value from xmallocz.
>
> Right now this leak is not very interesting, since we only call
> check_one_ref_format once.
>
> Signed-off-by: Ian Jackson <[email protected]>
> ---
> builtin/check-ref-format.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/builtin/check-ref-format.c b/builtin/check-ref-format.c
> index f12c19c..020ebe8 100644
> --- a/builtin/check-ref-format.c
> +++ b/builtin/check-ref-format.c
> @@ -63,8 +63,10 @@ static int check_one_ref_format(const char *refname)
> : check_refname_format(refname, flags);
> if (got)
> return 1;
If the function returns via the line above, then the memory will still
be leaked.
> - if (normalize)
> + if (normalize) {
> printf("%s\n", refname);
> + free((void*)refname);
> + }
> }
>
> int cmd_check_ref_format(int argc, const char **argv, const char *prefix)
>
Michael