Commit f0b10066 by Patrick Steinhardt

config_file: fix cast of readonly backend

In `backend_readonly_free`, the passed in config backend is being cast
to a `diskfile_backend` instead of to a `diskfile_readonly_backend`.
While this works out just fine because we only access its header values,
which were shared between both backends, it is undefined behaviour.

Use the correct type to fix this.
parent a3159df8
...@@ -625,7 +625,7 @@ static int config_unlock_readonly(git_config_backend *_cfg, int success) ...@@ -625,7 +625,7 @@ static int config_unlock_readonly(git_config_backend *_cfg, int success)
static void backend_readonly_free(git_config_backend *_backend) static void backend_readonly_free(git_config_backend *_backend)
{ {
diskfile_backend *backend = GIT_CONTAINER_OF(_backend, diskfile_backend, parent); diskfile_readonly_backend *backend = GIT_CONTAINER_OF(_backend, diskfile_readonly_backend, parent);
if (backend == NULL) if (backend == NULL)
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment