Commit 463c21e2c10e82d8e5ba4e3e7e908052f2b739f6

Nelson Elhage 2018-10-11T13:27:06

Apply code review feedback

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;