changeset 1307:6c116207ab2e

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.
author Mikael Berthe <mikael@lilotux.net>
date Sun, 09 Sep 2007 17:44:34 +0200
parents a7d21918234c
children b17754d9221b
files mcabber/src/main.c mcabber/src/otr.c
diffstat 2 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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")) {
--- 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;