Apply code review feedback
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
diff --git a/fuzzers/config_file_fuzzer.c b/fuzzers/config_file_fuzzer.c
index f0fa5e5..fa52642 100644
--- a/fuzzers/config_file_fuzzer.c
+++ b/fuzzers/config_file_fuzzer.c
@@ -43,20 +43,17 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
git_config_backend *backend = NULL;
int err = 0;
- err = git_config_new(&cfg);
- if (err != 0) {
+ if ((err = git_config_new(&cfg)) != 0) {
goto out;
}
- err = git_config_backend_from_string(&backend, (const char*)data, size);
- if (err != 0) {
+ if ((err = git_config_backend_from_string(&backend, (const char*)data, size)) != 0) {
goto out;
}
- err = git_config_add_backend(cfg, backend, 0, NULL, 0);
- if (err != 0) {
+ if ((err = git_config_add_backend(cfg, backend, 0, NULL, 0)) != 0) {
goto out;
}
- // Now owned by the config
+ /* Now owned by the config */
backend = NULL;
git_config_foreach(cfg, foreach_cb, NULL);
diff --git a/src/config_mem.c b/src/config_mem.c
index 5df6832..18e405a 100644
--- a/src/config_mem.c
+++ b/src/config_mem.c
@@ -198,7 +198,7 @@ int git_config_backend_from_string(git_config_backend **out, const char *cfg, si
return -1;
}
- if (git_buf_put(&backend->cfg, cfg, len) < 0) {
+ if (git_buf_set(&backend->cfg, cfg, len) < 0) {
git_config_entries_free(backend->entries);
git__free(backend);
return -1;