Commit b2640c3617c836e4efa4dbc1ef0c329a8ff58825

Etienne Samson 2018-06-20T02:27:03

config: add asserts for non-null parameters in lock/unlock

diff --git a/src/config.c b/src/config.c
index 0837500..042805e 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1182,6 +1182,8 @@ int git_config_lock(git_transaction **out, git_config *cfg)
 	git_config_backend *backend;
 	backend_internal *internal;
 
+	assert(cfg);
+
 	internal = git_vector_get(&cfg->backends, 0);
 	if (!internal || !internal->backend) {
 		giterr_set(GITERR_CONFIG, "cannot lock; the config has no backends");
@@ -1200,6 +1202,8 @@ int git_config_unlock(git_config *cfg, int commit)
 	git_config_backend *backend;
 	backend_internal *internal;
 
+	assert(cfg);
+
 	internal = git_vector_get(&cfg->backends, 0);
 	if (!internal || !internal->backend) {
 		giterr_set(GITERR_CONFIG, "cannot lock; the config has no backends");