From: SZEDER Gábor Date: Sat, 6 Apr 2019 11:34:21 +0000 (+0700) Subject: builtin rebase: use FREE_AND_NULL X-Git-Tag: v2.22.0-rc0~25^2~33 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/7762f44ee06f5a22254c8465a0642195f6c19658 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 Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff --git a/builtin/rebase.c b/builtin/rebase.c index 77deebc65c..868bcd1446 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -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))