add code to handle the case where engine id is a null ptr 80/320380/1 accepted/tizen_unified_x_asan accepted/tizen/unified/20241115.152451 accepted/tizen/unified/x/20241218.032707 accepted/tizen/unified/x/asan/20241224.004431
authorSejun Park <sejun79.park@samsung.com>
Thu, 14 Nov 2024 02:10:07 +0000 (11:10 +0900)
committerTizen AI <ai.tzn.sec@samsung.com>
Thu, 14 Nov 2024 07:59:49 +0000 (16:59 +0900)
Change-Id: If1544b1d85ff47cdddb6740b6cb413aa2e6435cc

common/VoiceControlConfig.cpp
packaging/voice-control.spec

index 9f754b2006acd711659b1a3c38a5e6bb717060b7..e73779211b1c8f23e608f648d57f166e38f6d8e4 100644 (file)
@@ -60,10 +60,15 @@ void VoiceControlConfig::setEngineId(const std::string engineId)
        }
 
        free(mConfig->engine_id);
+       mConfig->engine_id = nullptr;
        if (engineId.empty()) {
                mConfig->engine_id = nullptr;
        } else {
                mConfig->engine_id = strdup(engineId.c_str());
+               if (mConfig->engine_id == nullptr) {
+                       SLOG(LOG_ERROR, TAG_VCCONFIG, "[ERROR] Memory allocation failed");
+                       return;
+               }
        }
        SLOG(LOG_ERROR, TAG_VCCONFIG, "Set Engine ID : %s", mConfig->engine_id);
 }
index b6c20b81f7bc024ee0eab3d8eaad639d8ab2011a..9f190e654b61c77f1ba8151971742f97dd6fab91 100644 (file)
@@ -1,6 +1,6 @@
 Name:       voice-control
 Summary:    Voice control client library and daemon
-Version:    1.90.5
+Version:    1.90.6
 Release:    1
 Group:      Graphics & UI Framework/Voice Framework
 License:    Apache-2.0