Skip to content

Commit 185fe9c

Browse files
author
Edward Thomson
authored
Merge pull request libgit2#4051 from tiennou/clang-analyzer-1
Clang analyzer run
2 parents 048c5ea + 49be45a commit 185fe9c

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/ignore.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ int git_ignore__for_path(
278278
int error = 0;
279279
const char *workdir = git_repository_workdir(repo);
280280

281-
assert(ignores && path);
281+
assert(repo && ignores && path);
282282

283283
memset(ignores, 0, sizeof(*ignores));
284284
ignores->repo = repo;
@@ -503,9 +503,9 @@ int git_ignore_path_is_ignored(
503503
unsigned int i;
504504
git_attr_file *file;
505505

506-
assert(ignored && pathname);
506+
assert(repo && ignored && pathname);
507507

508-
workdir = repo ? git_repository_workdir(repo) : NULL;
508+
workdir = git_repository_workdir(repo);
509509

510510
memset(&path, 0, sizeof(path));
511511
memset(&ignores, 0, sizeof(ignores));

src/pack-objects.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1738,7 +1738,7 @@ int git_packbuilder_insert_walk(git_packbuilder *pb, git_revwalk *walk)
17381738
if (error == GIT_ITEROVER)
17391739
error = 0;
17401740

1741-
return 0;
1741+
return error;
17421742
}
17431743

17441744
int git_packbuilder_set_callbacks(git_packbuilder *pb, git_packbuilder_progress progress_cb, void *progress_cb_payload)

src/patch_generate.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,10 @@ int git_diff_foreach(
451451

452452
if (binary_cb || hunk_cb || data_cb) {
453453
if ((error = patch_generated_init(&patch, diff, idx)) != 0 ||
454-
(error = patch_generated_load(&patch, &xo.output)) != 0)
454+
(error = patch_generated_load(&patch, &xo.output)) != 0) {
455+
git_patch_free(&patch.base);
455456
return error;
457+
}
456458
}
457459

458460
if ((error = patch_generated_invoke_file_callback(&patch, &xo.output)) == 0) {

0 commit comments

Comments
 (0)