Merge branch 'master' into devel
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f1e0daf..36397c8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -141,7 +141,7 @@
     configure_file(Doxyfile.in Doxyfile)
 endif()
 
-# option - partial message read timeout in seconds
+# option - partial message read timeout in seconds (also used for internal <get-schema> RPC reply wait)
 if(NOT READ_TIMEOUT)
     set(READ_TIMEOUT 30)
 endif()
diff --git a/src/config.h.in b/src/config.h.in
index 097c235..0179821 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -50,7 +50,8 @@
 #define SCHEMAS_DIR "@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@"
 
 /*
- * Partial message read timeout in seconds (also used as nc_pollsession lock timeout)
+ * Partial message read timeout in seconds
+ * (also used as nc_pollsession lock timeout and internal <get-schema> RPC reply timeout)
  */
 #define NC_READ_TIMEOUT @READ_TIMEOUT@
 
diff --git a/src/session.c b/src/session.c
index 28741db..2ceb80e 100644
--- a/src/session.c
+++ b/src/session.c
@@ -1169,7 +1169,13 @@
     nc_thread_destroy();
     EVP_cleanup();
     ERR_free_strings();
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L // >= 1.1.0
+    // no de-init needed
+#elif OPENSSL_VERSION_NUMBER >= 0x10002000L // >= 1.0.2
+    SSL_COMP_free_compression_methods();
+#else
     sk_SSL_COMP_free(SSL_COMP_get_compression_methods());
+#endif
 
     CRYPTO_THREADID_set_callback(NULL);
     CRYPTO_set_locking_callback(NULL);
@@ -1205,7 +1211,13 @@
 nc_ssh_tls_destroy(void)
 {
     ERR_free_strings();
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L // >= 1.1.0
+    // no de-init needed
+#elif OPENSSL_VERSION_NUMBER >= 0x10002000L // >= 1.0.2
+    SSL_COMP_free_compression_methods();
+#else
     sk_SSL_COMP_free(SSL_COMP_get_compression_methods());
+#endif
 
     nc_ssh_destroy();
 
diff --git a/src/session_client.c b/src/session_client.c
index e6b54e3..9bb68a6 100644
--- a/src/session_client.c
+++ b/src/session_client.c
@@ -216,7 +216,7 @@
     }
 
     do {
-        msg = nc_recv_reply(session, rpc, msgid, 1000, 0, &reply);
+        msg = nc_recv_reply(session, rpc, msgid, NC_READ_TIMEOUT * 1000, 0, &reply);
     } while (msg == NC_MSG_NOTIF);
     nc_rpc_free(rpc);
     if (msg == NC_MSG_WOULDBLOCK) {
@@ -898,8 +898,8 @@
         }
         data_rpl->type = NC_RPL_DATA;
         if (!data) {
-            data_rpl->data = lyd_parse_xml(ctx, &xml->child,
-                                           LYD_OPT_RPCREPLY | LYD_OPT_DESTRUCT | parseroptions, rpc_act, NULL);
+            data_rpl->data = lyd_parse_xml(ctx, &xml->child, LYD_OPT_RPCREPLY | LYD_OPT_DESTRUCT | parseroptions,
+                                           rpc_act, NULL);
         } else {
             /* <get>, <get-config> */
             data_rpl->data = data;