mirror of
https://github.com/git/git
synced 2024-11-05 01:58:18 +00:00
Merge branch 'rj/add-i-leak-fix'
Leakfix. * rj/add-i-leak-fix: add: plug a leak on interactive_add add-patch: plug a leak handling the '/' command add-interactive: plug a leak in get_untracked_files apply: plug a leak in apply_data
This commit is contained in:
commit
e326e52010
14 changed files with 23 additions and 4 deletions
|
@ -865,6 +865,7 @@ static int get_untracked_files(struct repository *r,
|
||||||
}
|
}
|
||||||
|
|
||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
|
dir_clear(&dir);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1646,6 +1646,7 @@ static int patch_update_file(struct add_p_state *s,
|
||||||
err(s, _("No hunk matches the given pattern"));
|
err(s, _("No hunk matches the given pattern"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
regfree(®ex);
|
||||||
hunk_index = i;
|
hunk_index = i;
|
||||||
} else if (s->answer.buf[0] == 's') {
|
} else if (s->answer.buf[0] == 's') {
|
||||||
size_t splittable_into = hunk->splittable_into;
|
size_t splittable_into = hunk->splittable_into;
|
||||||
|
|
4
apply.c
4
apply.c
|
@ -3712,8 +3712,10 @@ static int apply_data(struct apply_state *state, struct patch *patch,
|
||||||
fprintf(stderr, _("Falling back to direct application...\n"));
|
fprintf(stderr, _("Falling back to direct application...\n"));
|
||||||
|
|
||||||
/* Note: with --reject, apply_fragments() returns 0 */
|
/* Note: with --reject, apply_fragments() returns 0 */
|
||||||
if (patch->direct_to_threeway || apply_fragments(state, &image, patch) < 0)
|
if (patch->direct_to_threeway || apply_fragments(state, &image, patch) < 0) {
|
||||||
|
clear_image(&image);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
patch->result = image.buf;
|
patch->result = image.buf;
|
||||||
patch->resultsize = image.len;
|
patch->resultsize = image.len;
|
||||||
|
|
|
@ -150,7 +150,7 @@ static int refresh(int verbose, const struct pathspec *pathspec)
|
||||||
int interactive_add(const char **argv, const char *prefix, int patch)
|
int interactive_add(const char **argv, const char *prefix, int patch)
|
||||||
{
|
{
|
||||||
struct pathspec pathspec;
|
struct pathspec pathspec;
|
||||||
int unused;
|
int unused, ret;
|
||||||
|
|
||||||
if (!git_config_get_bool("add.interactive.usebuiltin", &unused))
|
if (!git_config_get_bool("add.interactive.usebuiltin", &unused))
|
||||||
warning(_("the add.interactive.useBuiltin setting has been removed!\n"
|
warning(_("the add.interactive.useBuiltin setting has been removed!\n"
|
||||||
|
@ -163,9 +163,12 @@ int interactive_add(const char **argv, const char *prefix, int patch)
|
||||||
prefix, argv);
|
prefix, argv);
|
||||||
|
|
||||||
if (patch)
|
if (patch)
|
||||||
return !!run_add_p(the_repository, ADD_P_ADD, NULL, &pathspec);
|
ret = !!run_add_p(the_repository, ADD_P_ADD, NULL, &pathspec);
|
||||||
else
|
else
|
||||||
return !!run_add_i(the_repository, &pathspec);
|
ret = !!run_add_i(the_repository, &pathspec);
|
||||||
|
|
||||||
|
clear_pathspec(&pathspec);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int edit_patch(int argc, const char **argv, const char *prefix)
|
static int edit_patch(int argc, const char **argv, const char *prefix)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
test_description='git checkout --patch'
|
test_description='git checkout --patch'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./lib-patch-mode.sh
|
. ./lib-patch-mode.sh
|
||||||
|
|
||||||
test_expect_success 'setup' '
|
test_expect_success 'setup' '
|
||||||
|
|
|
@ -4,6 +4,7 @@ test_description='add -i basic tests'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
. "$TEST_DIRECTORY"/lib-terminal.sh
|
. "$TEST_DIRECTORY"/lib-terminal.sh
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ test_description='git apply handling binary patches
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup' '
|
test_expect_success 'setup' '
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
test_description='git apply boundary tests'
|
test_description='git apply boundary tests'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
L="c d e f g h i j k l m n o p q r s t u v w x"
|
L="c d e f g h i j k l m n o p q r s t u v w x"
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
test_description='git apply trying to add an ending line.
|
test_description='git apply trying to add an ending line.
|
||||||
|
|
||||||
'
|
'
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
# setup
|
# setup
|
||||||
|
|
|
@ -7,6 +7,7 @@ test_description='git apply with rejects
|
||||||
|
|
||||||
'
|
'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success setup '
|
test_expect_success setup '
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
test_description='apply a patch that is larger than the preimage'
|
test_description='apply a patch that is larger than the preimage'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
cat >F <<\EOF
|
cat >F <<\EOF
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='git am with options and not losing them'
|
test_description='git am with options and not losing them'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
tm="$TEST_DIRECTORY/t4252"
|
tm="$TEST_DIRECTORY/t4252"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
test_description='test am --quoted-cr=<action>'
|
test_description='test am --quoted-cr=<action>'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
DATA="$TEST_DIRECTORY/t4258"
|
DATA="$TEST_DIRECTORY/t4258"
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='hunk edit with "commit -p -m"'
|
test_description='hunk edit with "commit -p -m"'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup (initial)' '
|
test_expect_success 'setup (initial)' '
|
||||||
|
|
Loading…
Reference in a new issue