Skip to content

Commit

Permalink
Merge branch 'ab/diff-free-more'
Browse files Browse the repository at this point in the history
Leakfixes.

* ab/diff-free-more:
  diff.[ch]: have diff_free() free options->parseopts
  diff.[ch]: have diff_free() call clear_pathspec(opts.pathspec)
  • Loading branch information
gitster committed Feb 25, 2022
2 parents 0a01df0 + 6ee3636 commit 362f869
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 9 deletions.
6 changes: 3 additions & 3 deletions add-interactive.c
Original file line number Diff line number Diff line change
Expand Up @@ -797,14 +797,14 @@ static int run_revert(struct add_i_state *s, const struct pathspec *ps,
diffopt.flags.override_submodule_config = 1;
diffopt.repo = s->r;

if (do_diff_cache(&oid, &diffopt))
if (do_diff_cache(&oid, &diffopt)) {
diff_free(&diffopt);
res = -1;
else {
} else {
diffcore_std(&diffopt);
diff_flush(&diffopt);
}
free(paths);
clear_pathspec(&diffopt.pathspec);

if (!res && write_locked_index(s->r->index, &index_lock,
COMMIT_LOCK) < 0)
Expand Down
3 changes: 0 additions & 3 deletions blame.c
Original file line number Diff line number Diff line change
Expand Up @@ -1403,7 +1403,6 @@ static struct blame_origin *find_origin(struct repository *r,
}
}
diff_flush(&diff_opts);
clear_pathspec(&diff_opts.pathspec);
return porigin;
}

Expand Down Expand Up @@ -1447,7 +1446,6 @@ static struct blame_origin *find_rename(struct repository *r,
}
}
diff_flush(&diff_opts);
clear_pathspec(&diff_opts.pathspec);
return porigin;
}

Expand Down Expand Up @@ -2328,7 +2326,6 @@ static void find_copy_in_parent(struct blame_scoreboard *sb,
} while (unblamed);
target->suspects = reverse_blame(leftover, NULL);
diff_flush(&diff_opts);
clear_pathspec(&diff_opts.pathspec);
}

/*
Expand Down
1 change: 0 additions & 1 deletion builtin/reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ static int read_from_tree(const struct pathspec *pathspec,
return 1;
diffcore_std(&opt);
diff_flush(&opt);
clear_pathspec(&opt.pathspec);

return 0;
}
Expand Down
2 changes: 2 additions & 0 deletions diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -6452,6 +6452,8 @@ void diff_free(struct diff_options *options)

diff_free_file(options);
diff_free_ignore_regex(options);
clear_pathspec(&options->pathspec);
FREE_AND_NULL(options->parseopts);
}

void diff_flush(struct diff_options *options)
Expand Down
2 changes: 0 additions & 2 deletions notes-merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ static struct notes_merge_pair *diff_tree_remote(struct notes_merge_options *o,
oid_to_hex(&mp->remote));
}
diff_flush(&opt);
clear_pathspec(&opt.pathspec);

*num_changes = len;
return changes;
Expand Down Expand Up @@ -261,7 +260,6 @@ static void diff_tree_local(struct notes_merge_options *o,
oid_to_hex(&mp->local));
}
diff_flush(&opt);
clear_pathspec(&opt.pathspec);
}

static void check_notes_merge_worktree(struct notes_merge_options *o)
Expand Down

0 comments on commit 362f869

Please sign in to comment.