Skip to content

Commit f0b1006

Browse files
committed
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.
1 parent a3159df commit f0b1006

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/config_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ static int config_unlock_readonly(git_config_backend *_cfg, int success)
625625

626626
static void backend_readonly_free(git_config_backend *_backend)
627627
{
628-
diskfile_backend *backend = GIT_CONTAINER_OF(_backend, diskfile_backend, parent);
628+
diskfile_readonly_backend *backend = GIT_CONTAINER_OF(_backend, diskfile_readonly_backend, parent);
629629

630630
if (backend == NULL)
631631
return;

0 commit comments

Comments
 (0)