Merge branch 'rs/realloc-array'
[gitweb.git] / builtin / show-branch.c
index 5fd4e4e48839a9dc2998d3fba0e48008b902b12a..a1275237ee19473e18397e94868d24d52231d1c3 100644 (file)
@@ -563,7 +563,7 @@ static int git_show_branch_config(const char *var, const char *value, void *cb)
                        default_arg[default_num++] = "show-branch";
                } else if (default_alloc <= default_num + 1) {
                        default_alloc = default_alloc * 3 / 2 + 20;
-                       default_arg = xrealloc(default_arg, sizeof *default_arg * default_alloc);
+                       REALLOC_ARRAY(default_arg, default_alloc);
                }
                default_arg[default_num++] = xstrdup(value);
                default_arg[default_num] = NULL;
@@ -777,6 +777,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
                        sprintf(nth_desc, "%s@{%d}", *av, base+i);
                        append_ref(nth_desc, sha1, 1);
                }
+               free(ref);
        }
        else if (all_heads + all_remotes)
                snarf_refs(all_heads, all_remotes);