Do not free LDAP error string on Windows.
authorAndrej Kacian <ticho@claws-mail.org>
Sat, 20 Jun 2015 20:38:53 +0000 (22:38 +0200)
committerAndrej Kacian <ticho@claws-mail.org>
Sat, 20 Jun 2015 20:38:53 +0000 (22:38 +0200)
Fixes bug #2816 - LDAP addressbook search crashes Claws Mail.

src/ldaputil.c

index 0000a1eb6dc2776148e33bcda31bd6577b5f66ac..6c2952b06777e73385f9d9a6c972ae2242efa2b7 100644 (file)
@@ -324,7 +324,14 @@ const gchar *ldaputil_get_error(LDAP *ld)
                strncpy2(error, ld_error, sizeof(error));
        else
                strncpy2(error, _("Unknown error"), sizeof(error));
+#ifndef G_OS_WIN32
+       /* From https://msdn.microsoft.com/en-us/library/aa366594%28v=vs.85%29.aspx
+        * "LDAP_OPT_ERROR_STRING returns a pointer to an internal static
+        * string table, and ldap_memfree should not be called when using
+        * this session option."
+        */
        ldap_memfree(ld_error);
+#endif
 
        return error;
 }