Fix leaks, some warnings and an error by ethomson · Pull Request #3865 · libgit2/libgit2 · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
8 changes: 4 additions & 4 deletions include/git2/pack.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,21 +196,21 @@ GIT_EXTERN(int) git_packbuilder_foreach(git_packbuilder *pb, git_packbuilder_for
* @param pb the packbuilder
* @return the number of objects in the packfile
*/
GIT_EXTERN(uint32_t) git_packbuilder_object_count(git_packbuilder *pb);
GIT_EXTERN(size_t) git_packbuilder_object_count(git_packbuilder *pb);

/**
* Get the number of objects the packbuilder has already written out
*
* @param pb the packbuilder
* @return the number of objects which have already been written
*/
GIT_EXTERN(uint32_t) git_packbuilder_written(git_packbuilder *pb);
GIT_EXTERN(size_t) git_packbuilder_written(git_packbuilder *pb);

/** Packbuilder progress notification function */
typedef int (*git_packbuilder_progress)(
int stage,
unsigned int current,
unsigned int total,
uint32_t current,
uint32_t total,
void *payload);

/**
Expand Down
7 changes: 5 additions & 2 deletions src/apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ static int patch_image_init_fromstr(
for (start = in; start < in + in_len; start = end) {
end = memchr(start, '\n', in_len);

if (end < in + in_len)
if (end == NULL)
end = in + in_len;

else if (end < in + in_len)
end++;

line = git_pool_mallocz(&out->pool, 1);
Expand Down Expand Up @@ -97,7 +100,7 @@ static bool match_hunk(
git_diff_line *preimage_line = git_vector_get(&preimage->lines, i);
git_diff_line *image_line = git_vector_get(&image->lines, linenum + i);

if (preimage_line->content_len != preimage_line->content_len ||
if (preimage_line->content_len != image_line->content_len ||
memcmp(preimage_line->content, image_line->content, image_line->content_len) != 0) {
match = 0;
break;
Expand Down
1 change: 1 addition & 0 deletions src/crlf.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ static int crlf_check(
ca.eol = check_eol(attr_values[1]); /* eol */
}
ca.auto_crlf = GIT_AUTO_CRLF_DEFAULT;
ca.safe_crlf = GIT_SAFE_CRLF_DEFAULT;

/*
* Use the core Git logic to see if we should perform CRLF for this file
Expand Down
4 changes: 2 additions & 2 deletions src/index.c
Loading