aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/include
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-01-25 16:36:27 -0800
committerRiccardo Spagni <ric@spagni.net>2018-01-25 16:36:27 -0800
commit9fff66f0040af13b954e2f53b5bd00f62bf7bd9a (patch)
tree7c1470b7b28bd587c6a45d42f0105ae6b2b3976c /contrib/epee/include
parentMerge pull request #3011 (diff)
parentepee: check some error return values (diff)
downloadmonero-9fff66f0040af13b954e2f53b5bd00f62bf7bd9a.tar.xz
Merge pull request #3012
e4bbeff2 epee: check some error return values (moneromooo-monero)
Diffstat (limited to 'contrib/epee/include')
-rw-r--r--contrib/epee/include/storages/levin_abstract_invoke2.h26
1 files changed, 18 insertions, 8 deletions
diff --git a/contrib/epee/include/storages/levin_abstract_invoke2.h b/contrib/epee/include/storages/levin_abstract_invoke2.h
index 8ced9d689..b4f7abca8 100644
--- a/contrib/epee/include/storages/levin_abstract_invoke2.h
+++ b/contrib/epee/include/storages/levin_abstract_invoke2.h
@@ -60,8 +60,7 @@ namespace epee
LOG_ERROR("Failed to load_from_binary on command " << command);
return false;
}
- result_struct.load(stg_ret);
- return true;
+ return result_struct.load(stg_ret);
}
template<class t_arg, class t_transport>
@@ -105,9 +104,7 @@ namespace epee
LOG_ERROR("Failed to load_from_binary on command " << command);
return false;
}
- result_struct.load(stg_ret);
-
- return true;
+ return result_struct.load(stg_ret);
}
template<class t_result, class t_arg, class callback_t, class t_transport>
@@ -133,7 +130,12 @@ namespace epee
cb(LEVIN_ERROR_FORMAT, result_struct, context);
return false;
}
- result_struct.load(stg_ret);
+ if (!result_struct.load(stg_ret))
+ {
+ LOG_ERROR("Failed to load result struct on command " << command);
+ cb(LEVIN_ERROR_FORMAT, result_struct, context);
+ return false;
+ }
cb(code, result_struct, context);
return true;
}, inv_timeout);
@@ -176,7 +178,11 @@ namespace epee
boost::value_initialized<t_in_type> in_struct;
boost::value_initialized<t_out_type> out_struct;
- static_cast<t_in_type&>(in_struct).load(strg);
+ if (!static_cast<t_in_type&>(in_struct).load(strg))
+ {
+ LOG_ERROR("Failed to load in_struct in command " << command);
+ return -1;
+ }
int res = cb(command, static_cast<t_in_type&>(in_struct), static_cast<t_out_type&>(out_struct), context);
serialization::portable_storage strg_out;
static_cast<t_out_type&>(out_struct).store(strg_out);
@@ -200,7 +206,11 @@ namespace epee
return -1;
}
boost::value_initialized<t_in_type> in_struct;
- static_cast<t_in_type&>(in_struct).load(strg);
+ if (!static_cast<t_in_type&>(in_struct).load(strg))
+ {
+ LOG_ERROR("Failed to load in_struct in notify " << command);
+ return -1;
+ }
return cb(command, in_struct, context);
}