Merge branch 'sb/parse-object-buffer-eaten'
* sb/parse-object-buffer-eaten: parse_object_buffer: correct freeing the buffer
This commit is contained in:
7
object.c
7
object.c
@ -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 *parse_object_buffer(const unsigned char *sha1, enum object_type type, unsigned long size, void *buffer, int *eaten_p)
|
||||||
{
|
{
|
||||||
struct object *obj;
|
struct object *obj;
|
||||||
int eaten = 0;
|
*eaten_p = 0;
|
||||||
|
|
||||||
obj = NULL;
|
obj = NULL;
|
||||||
if (type == OBJ_BLOB) {
|
if (type == OBJ_BLOB) {
|
||||||
@ -164,7 +164,7 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
|
|||||||
if (!tree->object.parsed) {
|
if (!tree->object.parsed) {
|
||||||
if (parse_tree_buffer(tree, buffer, size))
|
if (parse_tree_buffer(tree, buffer, size))
|
||||||
return NULL;
|
return NULL;
|
||||||
eaten = 1;
|
*eaten_p = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (type == OBJ_COMMIT) {
|
} else if (type == OBJ_COMMIT) {
|
||||||
@ -174,7 +174,7 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
|
|||||||
return NULL;
|
return NULL;
|
||||||
if (!commit->buffer) {
|
if (!commit->buffer) {
|
||||||
commit->buffer = buffer;
|
commit->buffer = buffer;
|
||||||
eaten = 1;
|
*eaten_p = 1;
|
||||||
}
|
}
|
||||||
obj = &commit->object;
|
obj = &commit->object;
|
||||||
}
|
}
|
||||||
@ -191,7 +191,6 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
|
|||||||
}
|
}
|
||||||
if (obj && obj->type == OBJ_NONE)
|
if (obj && obj->type == OBJ_NONE)
|
||||||
obj->type = type;
|
obj->type = type;
|
||||||
*eaten_p = eaten;
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user