consider memory leak issue 52/305252/1
authordyamy-lee <dyamy.lee@samsung.com>
Tue, 30 Jan 2024 09:39:31 +0000 (18:39 +0900)
committerdyamy-lee <dyamy.lee@samsung.com>
Tue, 30 Jan 2024 09:39:31 +0000 (18:39 +0900)
There is no case about temp->default_lang is not null.
However, it couldn't sure that if the function's logic is changed.
So, this added the free() for considering if temp->default_lang is not null case

Change-Id: I226c248853301051c5444593d1297ef03a24ac98

server/ttsd_engine_agent.c

index f6719cd..1e3dd5f 100644 (file)
@@ -225,6 +225,9 @@ int ttsd_engine_agent_init(ttse_request_callback_s *callback)
        if (0 != ttsd_config_get_default_voice(&(temp->default_lang), &(temp->default_vctype))) {
                SLOG(LOG_WARN, tts_tag(), "[Server WARNING] There is No default voice in config");
                /* Set default voice */
+               if (temp->default_lang) {
+                       free(temp->default_lang);
+               }
                temp->default_lang = strdup(TTS_BASE_LANGUAGE);
                temp->default_vctype = TTSE_VOICE_TYPE_FEMALE;
        }