# HG changeset patch # User Mikael Berthe # Date 1189352674 -7200 # Node ID 6c116207ab2e3f3828fd38ee195be6f4a9e0a6f6 # Parent a7d21918234c4f04ffe0034c3b9aa67cae4386a5 Work around segfault in otrl_userstate_free() It only occurs when SSL is enabled and mcabber is linked to libgnutls. Seems to be a problem in libgcrypt when both libotr and libgnutls use it. diff -r a7d21918234c -r 6c116207ab2e mcabber/src/main.c --- a/mcabber/src/main.c Sun Sep 09 13:24:40 2007 +0200 +++ b/mcabber/src/main.c Sun Sep 09 17:44:34 2007 +0200 @@ -471,6 +471,7 @@ } } + scr_TerminateCurses(); #ifdef HAVE_LIBOTR otr_terminate(); #endif @@ -478,7 +479,6 @@ #ifdef HAVE_GPGME gpg_terminate(); #endif - scr_TerminateCurses(); #ifdef HAVE_ASPELL_H /* Deinitialize aspell */ if (settings_opt_get_int("aspell_enable")) { diff -r a7d21918234c -r 6c116207ab2e mcabber/src/otr.c --- a/mcabber/src/otr.c Sun Sep 09 13:24:40 2007 +0200 +++ b/mcabber/src/otr.c Sun Sep 09 17:44:34 2007 +0200 @@ -141,7 +141,18 @@ g_free(account); account = NULL; + + /* XXX This #ifdef is a quick workaround: when mcabber + * is linked to both gnutls and libotr, libgcrypt will + * segfault when we call otrl_userstate_free(). + * This is reported to be a bug in libgcrypt :-/ + * Mikael + */ +#if defined(HAVE_GNUTLS) && !defined(HAVE_OPENSSL) + if (!settings_opt_get_int("ssl")) +#endif otrl_userstate_free(userstate); + userstate = NULL; g_free(keyfile); keyfile = NULL;