Merge branch 'sb/branch-avoid-repeated-strbuf-release'
authorJunio C Hamano <gitster@pobox.com>
Sat, 7 Oct 2017 07:27:54 +0000 (16:27 +0900)
committerJunio C Hamano <gitster@pobox.com>
Sat, 7 Oct 2017 07:27:54 +0000 (16:27 +0900)
* sb/branch-avoid-repeated-strbuf-release:
  branch: reset instead of release a strbuf

builtin/branch.c

index 89e34e9..d7a876c 100644 (file)
@@ -217,7 +217,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
                if (!head_rev)
                        die(_("Couldn't look up commit object for HEAD"));
        }
-       for (i = 0; i < argc; i++, strbuf_release(&bname)) {
+       for (i = 0; i < argc; i++, strbuf_reset(&bname)) {
                char *target = NULL;
                int flags = 0;
 
@@ -282,8 +282,9 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
        }
 
        free(name);
+       strbuf_release(&bname);
 
-       return(ret);
+       return ret;
 }
 
 static int calc_maxwidth(struct ref_array *refs, int remote_bonus)