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>
SZEDER Gábor committed
Apr 6, 2019 at 18:34 UTC
7762f44ee06f5a22254c8465a0642195f6c19658
1 file changed
+1
-2
builtin/rebase.c
+1
-2
@@ -1592,8 +1592,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1592
branch_name = options.head_name;
1593
1594
} else {
1595
- free(options.head_name);
1596
- options.head_name = NULL;
1595
+ FREE_AND_NULL(options.head_name);
1596
branch_name = "HEAD";
1597
}
1598
if (get_oid("HEAD", &options.orig_head))