Documentation: refactor common operations into variables
[gitweb.git] / builtin / log.c
index dd9f2436caa0a85575b3289aec5275263850ac3e..2fb34c7de96a4236327d46bf1392d54fa882c17f 100644 (file)
@@ -864,6 +864,7 @@ static void add_branch_description(struct strbuf *buf, const char *branch_name)
                strbuf_addbuf(buf, &desc);
                strbuf_addch(buf, '\n');
        }
+       strbuf_release(&desc);
 }
 
 static char *find_branch_name(struct rev_info *rev)
@@ -1439,7 +1440,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
                        continue;
 
                nr++;
-               list = xrealloc(list, nr * sizeof(list[0]));
+               REALLOC_ARRAY(list, nr);
                list[nr - 1] = commit;
        }
        if (nr == 0)