builtin rebase: use FREE_AND_NULL

Use the macro FREE_AND_NULL to release memory allocated for
'head_name' and clear its pointer.

Patch generated with 'contrib/coccinelle/free.cocci' and Coccinelle
v1.0.7 (previous Coccinelle versions don't notice this).

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
SZEDER Gábor 2019-04-06 18:34:21 +07:00 committed by Junio C Hamano
parent 041f5ea1cf
commit 7762f44ee0

View file

@ -1592,8 +1592,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
branch_name = options.head_name;
} else {
free(options.head_name);
options.head_name = NULL;
FREE_AND_NULL(options.head_name);
branch_name = "HEAD";
}
if (get_oid("HEAD", &options.orig_head))