]> git.proxmox.com Git - libgit2.git/commitdiff
merge_driver: fix missing `goto done;`
authorPatrick Steinhardt <ps@pks.im>
Fri, 1 Apr 2016 07:37:55 +0000 (09:37 +0200)
committerPatrick Steinhardt <ps@pks.im>
Fri, 1 Apr 2016 07:37:55 +0000 (09:37 +0200)
The code initializing the merge driver registry accidentally
forgot a `goto done` in case of an error. Because of this the
next line, which registers the global shutdown callback for the
merge drivers, is only called when an error occured.

Fix this by adding the missing `goto done`. This fixes some
memory leaks when the global state is shut down.

src/merge_driver.c

index cc039dbb54c6a7992e04688c4565ee5a5ca209cb..88a53ecdbf651b2fb5e516e61ce6db85084d3947 100644 (file)
@@ -178,6 +178,7 @@ int git_merge_driver_global_init(void)
                        merge_driver_name__union, &git_merge_driver__union.base)) < 0 ||
                (error = merge_driver_registry_insert(
                        merge_driver_name__binary, &git_merge_driver__binary)) < 0)
+               goto done;
 
        git__on_shutdown(git_merge_driver_global_shutdown);