提交 78bea4fc 编写于 作者: L liuqi

Check not null for pointer arguments.

上级 5b403dd2
...@@ -100,6 +100,7 @@ bool RunInference(MaceEngine *engine, ...@@ -100,6 +100,7 @@ bool RunInference(MaceEngine *engine,
std::map<std::string, float*> *output_infos, std::map<std::string, float*> *output_infos,
StatSummarizer *summarizer, StatSummarizer *summarizer,
int64_t *inference_time_us) { int64_t *inference_time_us) {
MACE_CHECK_NOTNULL(output_infos);
RunMetadata run_metadata; RunMetadata run_metadata;
RunMetadata *run_metadata_ptr = nullptr; RunMetadata *run_metadata_ptr = nullptr;
if (summarizer) { if (summarizer) {
...@@ -144,6 +145,7 @@ bool Run(MaceEngine *engine, ...@@ -144,6 +145,7 @@ bool Run(MaceEngine *engine,
int64_t sleep_sec, int64_t sleep_sec,
int64_t *total_time_us, int64_t *total_time_us,
int64_t *actual_num_runs) { int64_t *actual_num_runs) {
MACE_CHECK_NOTNULL(output_infos);
*total_time_us = 0; *total_time_us = 0;
LOG(INFO) << "Running benchmark for max " << num_runs << " iterators, max " LOG(INFO) << "Running benchmark for max " << num_runs << " iterators, max "
......
...@@ -13,6 +13,7 @@ namespace mace { ...@@ -13,6 +13,7 @@ namespace mace {
namespace utils { namespace utils {
bool StringConsume(const std::string &x, std::string *arg) { bool StringConsume(const std::string &x, std::string *arg) {
MACE_CHECK_NOTNULL(arg);
if ((arg->size() >= x.size()) && if ((arg->size() >= x.size()) &&
(memcmp(arg->data(), x.data(), x.size()) == 0)) { (memcmp(arg->data(), x.data(), x.size()) == 0)) {
*arg = arg->substr(x.size()); *arg = arg->substr(x.size());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册