fmt-merge-msg: plug small leak of commit buffer
[gitweb.git] / builtin / index-pack.c
index fa74972886cc8e6c0f6308e28de26a13cae6a2b7..42551ce4ff65c170fffb88c5e9bb639bfc83fe91 100644 (file)
@@ -774,7 +774,8 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
                        }
                        if (obj->type == OBJ_COMMIT) {
                                struct commit *commit = (struct commit *) obj;
-                               commit->buffer = NULL;
+                               if (detach_commit_buffer(commit) != data)
+                                       die("BUG: parse_object_buffer transmogrified our buffer");
                        }
                        obj->flags |= FLAG_CHECKED;
                }
@@ -1502,7 +1503,7 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
        if (argc == 2 && !strcmp(argv[1], "-h"))
                usage(index_pack_usage);
 
-       read_replace_refs = 0;
+       check_replace_refs = 0;
 
        reset_pack_idx_option(&opts);
        git_config(git_index_pack_config, &opts);