Skip to content

Commit e208b19

Browse files
committed
tests: config: catch OOM when assembling conditional config
When assembling contents of the conditionally including file, we use `git_buf_printf` and `git_buf_puts` without checking for error returns. Add `cl_git_pass` to fix this.
1 parent 835211d commit e208b19

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/config/conditionals.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ void test_config_conditionals__cleanup(void)
2222

2323
static void assert_condition_includes(const char *keyword, const char *path, bool expected)
2424
{
25-
git_config *cfg;
2625
git_buf buf = GIT_BUF_INIT;
26+
git_config *cfg;
2727

28-
git_buf_printf(&buf, "[includeIf \"%s:%s\"]\n", keyword, path);
29-
git_buf_puts(&buf, "path = other\n");
28+
cl_git_pass(git_buf_printf(&buf, "[includeIf \"%s:%s\"]\n", keyword, path));
29+
cl_git_pass(git_buf_puts(&buf, "path = other\n"));
3030

3131
cl_git_mkfile("empty_standard_repo/.git/config", buf.ptr);
3232
cl_git_mkfile("empty_standard_repo/.git/other", "[foo]\nbar=baz\n");

0 commit comments

Comments
 (0)