Skip to content

Commit

Permalink
Merge branch 'sb/parse-object-buffer-eaten'
Browse files Browse the repository at this point in the history
* sb/parse-object-buffer-eaten:
  parse_object_buffer: correct freeing the buffer
  • Loading branch information
Junio C Hamano committed Jul 22, 2013
2 parents 4ca8ae7 + 8e92e8f commit 5701c3d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions object.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ struct object *lookup_unknown_object(const unsigned char *sha1)
struct object *parse_object_buffer(const unsigned char *sha1, enum object_type type, unsigned long size, void *buffer, int *eaten_p)
{
struct object *obj;
int eaten = 0;
*eaten_p = 0;

obj = NULL;
if (type == OBJ_BLOB) {
Expand All @@ -164,7 +164,7 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
if (!tree->object.parsed) {
if (parse_tree_buffer(tree, buffer, size))
return NULL;
eaten = 1;
*eaten_p = 1;
}
}
} else if (type == OBJ_COMMIT) {
Expand All @@ -174,7 +174,7 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
return NULL;
if (!commit->buffer) {
commit->buffer = buffer;
eaten = 1;
*eaten_p = 1;
}
obj = &commit->object;
}
Expand All @@ -191,7 +191,6 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
}
if (obj && obj->type == OBJ_NONE)
obj->type = type;
*eaten_p = eaten;
return obj;
}

Expand Down

0 comments on commit 5701c3d

Please sign in to comment.