session client BUGFIX use of uninitialized variable
diff --git a/src/session_client.c b/src/session_client.c
index 44380a6..262dd45 100644
--- a/src/session_client.c
+++ b/src/session_client.c
@@ -476,15 +476,15 @@
name = submod_name;
if (sub_rev) {
rev = sub_rev;
- } else {
- if (!clb_data->schemas[u].submodules) {
+ } else if (match) {
+ if (!clb_data->schemas[match - 1].submodules) {
ERR("Session %u: requested submodule \"%s\" is not known for schema \"%s\" on server side.",
clb_data->session->id, submod_name, mod_name);
return NULL;
}
- for (v = 0; clb_data->schemas[u].submodules[v].name; ++v) {
- if (!strcmp(submod_name, clb_data->schemas[u].submodules[v].name)) {
- rev = sub_rev = clb_data->schemas[u].submodules[v].revision;
+ for (v = 0; clb_data->schemas[match - 1].submodules[v].name; ++v) {
+ if (!strcmp(submod_name, clb_data->schemas[match - 1].submodules[v].name)) {
+ rev = sub_rev = clb_data->schemas[match - 1].submodules[v].revision;
}
}
if (!rev) {