Merge pull request #38 from fanchanghu/devel

server BUGFIX nc_ps_poll deadlock due to multi-thread conflict
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4fc1d6f..f5fa9b3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,7 +28,7 @@
 # set version
 set(LIBNETCONF2_MAJOR_VERSION 0)
 set(LIBNETCONF2_MINOR_VERSION 9)
-set(LIBNETCONF2_MICRO_VERSION 12)
+set(LIBNETCONF2_MICRO_VERSION 13)
 set(LIBNETCONF2_VERSION ${LIBNETCONF2_MAJOR_VERSION}.${LIBNETCONF2_MINOR_VERSION}.${LIBNETCONF2_MICRO_VERSION})
 set(LIBNETCONF2_SOVERSION ${LIBNETCONF2_MAJOR_VERSION}.${LIBNETCONF2_MINOR_VERSION})
 
diff --git a/src/messages_client.h b/src/messages_client.h
index 7d05053..13f54e6 100644
--- a/src/messages_client.h
+++ b/src/messages_client.h
@@ -216,7 +216,7 @@
  * needed NETCONF capabilities for the RPC.
  *
  * @param[in] source Source datastore being queried.
- * @param[in] filter Optional filter data, an XML subtree or XPath expression.
+ * @param[in] filter Optional filter data, an XML subtree or XPath expression (with JSON prefixes).
  * @param[in] wd_mode Optional with-defaults capability mode.
  * @param[in] paramtype How to further manage data parameters.
  * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
@@ -317,7 +317,7 @@
  * check. Created object can be sent via any NETCONF session which supports all the
  * needed NETCONF capabilities for the RPC.
  *
- * @param[in] filter Optional filter data, an XML subtree or XPath expression.
+ * @param[in] filter Optional filter data, an XML subtree or XPath expression (with JSON prefixes).
  * @param[in] wd_mode Optional with-defaults capability mode.
  * @param[in] paramtype How to further manage data parameters.
  * @return Created RPC object to send via a NETCONF session or NULL in case of (memory allocation) error.
@@ -428,7 +428,7 @@
  * needed NETCONF capabilities for the RPC.
  *
  * @param[in] stream_name Optional name of a NETCONF stream to subscribe to.
- * @param[in] filter Optional filter data, an XML subtree or XPath expression.
+ * @param[in] filter Optional filter data, an XML subtree or XPath expression (with JSON prefixes).
  * @param[in] start_time Optional YANG datetime identifying the start of the subscription.
  * @param[in] stop_time Optional YANG datetime identifying the end of the subscription.
  * @param[in] paramtype How to further manage data parameters.
diff --git a/src/session_client.c b/src/session_client.c
index 4ef9d7c..89f236e 100644
--- a/src/session_client.c
+++ b/src/session_client.c
@@ -696,7 +696,12 @@
             /* unset callback back to use searchpath */
             ly_ctx_set_module_imp_clb(session->ctx, NULL, NULL);
         } else { /* !mod && !implemented - will be loaded automatically, but remember to set features in the end */
-            assert(!imports_flag);
+            if (imports_flag) {
+                ERR("Module \"%s@%s\" is supposed to be imported, but no other module imports it.",
+                    name, revision ? revision : "<latest>");
+                ret = -1;
+                goto cleanup;
+            }
             ly_set_add(imports, modules->set.d[u], LY_SET_OPT_USEASLIST);
             continue;
         }
@@ -2056,6 +2061,7 @@
                 ietfncwd = ly_ctx_get_module(session->ctx, "ietf-netconf-with-defaults", NULL);
                 if (!ietfncwd) {
                     ERR("Session %u: missing \"ietf-netconf-with-defaults\" schema in the context.", session->id);
+                    lyd_free(data);
                     return NC_MSG_ERROR;
                 }
             }