fmt-merge-msg: plug small leak of commit buffer
[gitweb.git] / builtin / index-pack.c
index b9f6e12c0e91635eafd8510dc7cf20d6c3e58433..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;
                }