summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2019-08-01 13:42:19 +0200
committerPatrick Steinhardt <ps@pks.im>2019-08-01 13:42:19 +0200
commite208b1953853f27f2de23f429e9518480a2d51e2 (patch)
tree2c05c3f37cde22d0d1c19961311fcfa5a3ee3f2d
parent835211dc4b6afef650222ca2e24545938e28e0cb (diff)
downloadlibgit2-e208b1953853f27f2de23f429e9518480a2d51e2.tar.gz
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.
-rw-r--r--tests/config/conditionals.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/config/conditionals.c b/tests/config/conditionals.c
index 0e629e48f..e2c74c1f5 100644
--- a/tests/config/conditionals.c
+++ b/tests/config/conditionals.c
@@ -22,11 +22,11 @@ void test_config_conditionals__cleanup(void)
static void assert_condition_includes(const char *keyword, const char *path, bool expected)
{
- git_config *cfg;
git_buf buf = GIT_BUF_INIT;
+ git_config *cfg;
- git_buf_printf(&buf, "[includeIf \"%s:%s\"]\n", keyword, path);
- git_buf_puts(&buf, "path = other\n");
+ cl_git_pass(git_buf_printf(&buf, "[includeIf \"%s:%s\"]\n", keyword, path));
+ cl_git_pass(git_buf_puts(&buf, "path = other\n"));
cl_git_mkfile("empty_standard_repo/.git/config", buf.ptr);
cl_git_mkfile("empty_standard_repo/.git/other", "[foo]\nbar=baz\n");