]> git.ipfire.org Git - thirdparty/git.git/commitdiff
builtin rebase: use FREE_AND_NULL
authorSZEDER Gábor <szeder.dev@gmail.com>
Sat, 6 Apr 2019 11:34:21 +0000 (18:34 +0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 8 Apr 2019 08:26:32 +0000 (17:26 +0900)
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>
builtin/rebase.c

index 77deebc65c6bd7fbe6261b91cfb78c7ec3f85c2d..868bcd1446d7723adab422a86d1f1914899d1f52 100644 (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))