Skip to content
Browse files

commit: save the commit buffer off when parsing a commit

object.

A fair number of the users potentially want to look at the
commit objects more closely, and if you worry about memory
leaking in certain applications, you can always do a

	free(commit->buffer);
	commit->buffer = NULL;

by hand after parsing them.
  • Loading branch information...
1 parent e871b64 commit 3ff1fbbb9446e03050047a67247151887ee59e70 Linus Torvalds committed May 25, 2005
Showing with 5 additions and 0 deletions.
  1. +4 −0 commit.c
  2. +1 −0 commit.h
View
4 commit.c
@@ -103,6 +103,10 @@ int parse_commit(struct commit *item)
sha1_to_hex(item->object.sha1));
}
ret = parse_commit_buffer(item, buffer, size);
+ if (!ret) {
+ item->buffer = buffer;
+ return 0;
+ }
free(buffer);
return ret;
}
View
1 commit.h
@@ -14,6 +14,7 @@ struct commit {
unsigned long date;
struct commit_list *parents;
struct tree *tree;
+ const char *buffer;
};
extern const char *commit_type;

0 comments on commit 3ff1fbb

Please sign in to comment.
Something went wrong with that request. Please try again.