Skip to content

Commit 362f869

Browse files
committed
Merge branch 'ab/diff-free-more'
Leakfixes. * ab/diff-free-more: diff.[ch]: have diff_free() free options->parseopts diff.[ch]: have diff_free() call clear_pathspec(opts.pathspec)
2 parents 0a01df0 + 6ee3636 commit 362f869

File tree

5 files changed

+5
-9
lines changed

5 files changed

+5
-9
lines changed

add-interactive.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -797,14 +797,14 @@ static int run_revert(struct add_i_state *s, const struct pathspec *ps,
797797
diffopt.flags.override_submodule_config = 1;
798798
diffopt.repo = s->r;
799799

800-
if (do_diff_cache(&oid, &diffopt))
800+
if (do_diff_cache(&oid, &diffopt)) {
801+
diff_free(&diffopt);
801802
res = -1;
802-
else {
803+
} else {
803804
diffcore_std(&diffopt);
804805
diff_flush(&diffopt);
805806
}
806807
free(paths);
807-
clear_pathspec(&diffopt.pathspec);
808808

809809
if (!res && write_locked_index(s->r->index, &index_lock,
810810
COMMIT_LOCK) < 0)

blame.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,7 +1403,6 @@ static struct blame_origin *find_origin(struct repository *r,
14031403
}
14041404
}
14051405
diff_flush(&diff_opts);
1406-
clear_pathspec(&diff_opts.pathspec);
14071406
return porigin;
14081407
}
14091408

@@ -1447,7 +1446,6 @@ static struct blame_origin *find_rename(struct repository *r,
14471446
}
14481447
}
14491448
diff_flush(&diff_opts);
1450-
clear_pathspec(&diff_opts.pathspec);
14511449
return porigin;
14521450
}
14531451

@@ -2328,7 +2326,6 @@ static void find_copy_in_parent(struct blame_scoreboard *sb,
23282326
} while (unblamed);
23292327
target->suspects = reverse_blame(leftover, NULL);
23302328
diff_flush(&diff_opts);
2331-
clear_pathspec(&diff_opts.pathspec);
23322329
}
23332330

23342331
/*

builtin/reset.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,6 @@ static int read_from_tree(const struct pathspec *pathspec,
280280
return 1;
281281
diffcore_std(&opt);
282282
diff_flush(&opt);
283-
clear_pathspec(&opt.pathspec);
284283

285284
return 0;
286285
}

diff.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6452,6 +6452,8 @@ void diff_free(struct diff_options *options)
64526452

64536453
diff_free_file(options);
64546454
diff_free_ignore_regex(options);
6455+
clear_pathspec(&options->pathspec);
6456+
FREE_AND_NULL(options->parseopts);
64556457
}
64566458

64576459
void diff_flush(struct diff_options *options)

notes-merge.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ static struct notes_merge_pair *diff_tree_remote(struct notes_merge_options *o,
175175
oid_to_hex(&mp->remote));
176176
}
177177
diff_flush(&opt);
178-
clear_pathspec(&opt.pathspec);
179178

180179
*num_changes = len;
181180
return changes;
@@ -261,7 +260,6 @@ static void diff_tree_local(struct notes_merge_options *o,
261260
oid_to_hex(&mp->local));
262261
}
263262
diff_flush(&opt);
264-
clear_pathspec(&opt.pathspec);
265263
}
266264

267265
static void check_notes_merge_worktree(struct notes_merge_options *o)

0 commit comments

Comments
 (0)