mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-02 16:34:37 +00:00
commit
7e53e8ce45
@ -478,14 +478,15 @@ cleanup:
|
||||
* The blobs of origin and porigin exactly match, so everything origin is
|
||||
* suspected for can be blamed on the parent.
|
||||
*/
|
||||
static void pass_whole_blame(git_blame *blame,
|
||||
static int pass_whole_blame(git_blame *blame,
|
||||
git_blame__origin *origin, git_blame__origin *porigin)
|
||||
{
|
||||
git_blame__entry *e;
|
||||
|
||||
if (!porigin->blob)
|
||||
git_object_lookup((git_object**)&porigin->blob, blame->repository,
|
||||
git_blob_id(origin->blob), GIT_OBJ_BLOB);
|
||||
if (!porigin->blob &&
|
||||
git_object_lookup((git_object**)&porigin->blob, blame->repository,
|
||||
git_blob_id(origin->blob), GIT_OBJ_BLOB) < 0)
|
||||
return -1;
|
||||
for (e=blame->ent; e; e=e->next) {
|
||||
if (!same_suspect(e->suspect, origin))
|
||||
continue;
|
||||
@ -493,6 +494,8 @@ static void pass_whole_blame(git_blame *blame,
|
||||
origin_decref(e->suspect);
|
||||
e->suspect = porigin;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pass_blame(git_blame *blame, git_blame__origin *origin, uint32_t opt)
|
||||
@ -543,7 +546,8 @@ static int pass_blame(git_blame *blame, git_blame__origin *origin, uint32_t opt)
|
||||
}
|
||||
if (porigin->blob && origin->blob &&
|
||||
!git_oid_cmp(git_blob_id(porigin->blob), git_blob_id(origin->blob))) {
|
||||
pass_whole_blame(blame, origin, porigin);
|
||||
error = pass_whole_blame(blame, origin, porigin);
|
||||
goto finish;
|
||||
origin_decref(porigin);
|
||||
goto finish;
|
||||
}
|
||||
|
@ -1041,8 +1041,9 @@ static int parse_section_header_ext(struct reader *reader, const char *line, con
|
||||
GITERR_CHECK_ALLOC_ADD(&alloc_len, base_name_len, quoted_len);
|
||||
GITERR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 2);
|
||||
|
||||
git_buf_grow(&buf, alloc_len);
|
||||
git_buf_printf(&buf, "%s.", base_name);
|
||||
if (git_buf_grow(&buf, alloc_len) < 0 ||
|
||||
git_buf_printf(&buf, "%s.", base_name) < 0)
|
||||
goto end_parse;
|
||||
|
||||
rpos = 0;
|
||||
|
||||
@ -1082,6 +1083,11 @@ static int parse_section_header_ext(struct reader *reader, const char *line, con
|
||||
} while (line + rpos < last_quote);
|
||||
|
||||
end_parse:
|
||||
if (git_buf_oom(&buf)) {
|
||||
git_buf_free(&buf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (line[rpos] != '"' || line[rpos + 1] != ']') {
|
||||
set_parse_error(reader, rpos, "Unexpected text after closing quotes");
|
||||
git_buf_free(&buf);
|
||||
|
@ -44,7 +44,11 @@ static git_diff_parsed *diff_parsed_alloc(void)
|
||||
diff->base.patch_fn = git_patch_parsed_from_diff;
|
||||
diff->base.free_fn = diff_parsed_free;
|
||||
|
||||
git_diff_init_options(&diff->base.opts, GIT_DIFF_OPTIONS_VERSION);
|
||||
if (git_diff_init_options(&diff->base.opts, GIT_DIFF_OPTIONS_VERSION) < 0) {
|
||||
git__free(&diff);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
diff->base.opts.flags &= ~GIT_DIFF_IGNORE_CASE;
|
||||
|
||||
git_pool_init(&diff->base.pool, 1);
|
||||
|
@ -428,7 +428,7 @@ static int pack_backend__read_prefix(
|
||||
git_oid_cpy(out_oid, short_oid);
|
||||
} else {
|
||||
struct git_pack_entry e;
|
||||
git_rawobj raw;
|
||||
git_rawobj raw = {NULL};
|
||||
|
||||
if ((error = pack_entry_find_prefix(
|
||||
&e, (struct pack_backend *)backend, short_oid, len)) == 0 &&
|
||||
|
@ -66,7 +66,7 @@ static void shutdown_ssl_locking(void)
|
||||
CRYPTO_set_locking_callback(NULL);
|
||||
|
||||
for (i = 0; i < num_locks; ++i)
|
||||
git_mutex_free(openssl_locks);
|
||||
git_mutex_free(&openssl_locks[i]);
|
||||
git__free(openssl_locks);
|
||||
}
|
||||
|
||||
|
@ -444,9 +444,9 @@ static int parse_header_git(
|
||||
goto done;
|
||||
|
||||
parse_advance_ws(ctx);
|
||||
parse_advance_expected_str(ctx, "\n");
|
||||
|
||||
if (ctx->line_len > 0) {
|
||||
if (parse_advance_expected_str(ctx, "\n") < 0 ||
|
||||
ctx->line_len > 0) {
|
||||
error = parse_err("trailing data at line %"PRIuZ, ctx->line_num);
|
||||
goto done;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user