charon-cmd: Register atexit() handler for libcharon_deinit twice
authorTobias Brunner <tobias@strongswan.org>
Thu, 6 Dec 2018 14:01:52 +0000 (15:01 +0100)
committerTobias Brunner <tobias@strongswan.org>
Fri, 7 Dec 2018 09:30:08 +0000 (10:30 +0100)
Similar to cbe9e575eef5, this avoids issues with libraries that are
pulled in via plugins and register their own atexit() handlers.

src/charon-cmd/charon-cmd.c

index 82bc3ee..e85e21d 100644 (file)
@@ -348,6 +348,9 @@ int main(int argc, char *argv[])
        {
                exit(SS_RC_INITIALIZATION_FAILED);
        }
+       /* register this again after loading plugins to avoid issues with libraries
+        * that register atexit() handlers */
+       atexit(libcharon_deinit);
        if (!lib->caps->drop(lib->caps))
        {
                exit(SS_RC_INITIALIZATION_FAILED);