From a48ba9c66aa5332d5fb1b7a993d8d6bcb6b17934 Mon Sep 17 00:00:00 2001 From: Tae-Young Chung Date: Tue, 22 Feb 2022 16:07:25 +0900 Subject: [PATCH] Fix bugs [Version] 0.4.1-0 [Issue type] Bug fix 1. Initialize member variables in class ctor 2. Fix usage after g_free() Change-Id: Ib0a44d17801579596fec6c70fdc58cf00a596b9c Signed-off-by: Tae-Young Chung --- packaging/inference-engine-interface.spec | 4 ++-- tools/include/InputMetadata.h | 7 ++++++- tools/include/OutputMetadata.h | 14 +++++++++++--- tools/src/inference_engine_cltuner.cpp | 2 +- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/packaging/inference-engine-interface.spec b/packaging/inference-engine-interface.spec index 8b37e62..c1545ba 100644 --- a/packaging/inference-engine-interface.spec +++ b/packaging/inference-engine-interface.spec @@ -1,7 +1,7 @@ Name: inference-engine-interface Summary: Interface of inference engines -Version: 0.4.0 -Release: 1 +Version: 0.4.1 +Release: 0 Group: Multimedia/Framework License: Apache-2.0 Source0: %{name}-%{version}.tar.gz diff --git a/tools/include/InputMetadata.h b/tools/include/InputMetadata.h index c894d34..9d4cffe 100644 --- a/tools/include/InputMetadata.h +++ b/tools/include/InputMetadata.h @@ -80,7 +80,12 @@ namespace Cltuner inference_tensor_data_type_e dataType; inference_tensor_shape_type_e shapeType; // TODO: define mv_inference_shape_type_e - LayerInfo() = default; + LayerInfo() : + name(), + dims(), + colorSpace(INFERENCE_COLORSPACE_INVALID), + dataType(INFERENCE_TENSOR_DATA_TYPE_NONE), + shapeType(INFERENCE_TENSOR_SHAPE_NCHW) {}; ~LayerInfo() = default; int GetWidth() const; diff --git a/tools/include/OutputMetadata.h b/tools/include/OutputMetadata.h index 92f4b85..7213ddf 100644 --- a/tools/include/OutputMetadata.h +++ b/tools/include/OutputMetadata.h @@ -124,7 +124,10 @@ namespace Cltuner inference_box_decoding_type_e decodingType; public: - Label() = default; + Label() : + name(), + dimInfo(), + decodingType(INFERENCE_BOX_DECODING_TYPE_SSD_ANCHOR) {}; ~Label() = default; std::string GetName() { return name; } DimInfo GetDimInfo() { return dimInfo; } @@ -139,7 +142,9 @@ namespace Cltuner DimInfo dimInfo; public: - Number() = default; + Number() : + name(), + dimInfo() {}; ~Number() = default; std::string GetName() { return name; } DimInfo GetDimInfo() { return dimInfo; } @@ -200,7 +205,10 @@ namespace Cltuner DimInfo dimInfo; int shapeType; public: - OffsetVec() = default; + OffsetVec() : + name(), + dimInfo(), + shapeType(INFERENCE_TENSOR_SHAPE_NCHW) {}; ~OffsetVec() = default; std::string GetName() { return name; } DimInfo GetDimInfo() { return dimInfo; } diff --git a/tools/src/inference_engine_cltuner.cpp b/tools/src/inference_engine_cltuner.cpp index 368467d..678faf5 100644 --- a/tools/src/inference_engine_cltuner.cpp +++ b/tools/src/inference_engine_cltuner.cpp @@ -503,10 +503,10 @@ static gboolean __interpret(char* cmd, char* cmd2) value = g_strsplit(cmd2, ".", 0); json_path = g_strdup_printf("%s.json", value[0]); model_paths.push_back(model_path); - g_free(model_path); LOGI("model_path : [%s]\n", model_path); LOGI("jsonfile path [%s] \n", json_path); + g_free(model_path); g_strfreev(value); res = ParseMetadata(metadata, std::string(json_path)); -- 2.7.4