diff --git a/lib/ssluse.c b/lib/ssluse.c
index a05a314281b24e4c39e0add4827b5e4c09783768..a31cb13dcead6ffd3491466ea3199aa1633938f7 100644
--- a/lib/ssluse.c
+++ b/lib/ssluse.c
@@ -437,7 +437,11 @@ void Curl_SSL_cleanup(void)
     ENGINE_cleanup();
 #endif
 
+#ifdef HAVE_CRYPTO_CLEANUP_ALL_EX_DATA
+    /* this function was not present in 0.9.6b, but was added sometimes
+       later */
     CRYPTO_cleanup_all_ex_data();
+#endif
 
     init_ssl=0; /* not inited any more */
   }