From: Woongsuk Cho Date: Tue, 10 Jul 2018 01:17:08 +0000 (+0900) Subject: use new operation instead of calloc to avoid crash X-Git-Tag: submit/tizen/20180710.012701~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ae94112942c59996f0132b7879711d318cfd44a;p=platform%2Fcore%2Fdotnet%2Flauncher.git use new operation instead of calloc to avoid crash Change-Id: I6cc0995be7fb08737ce47aa8712f5883ae072e70 --- diff --git a/NativeLauncher/util/path_manager.cc b/NativeLauncher/util/path_manager.cc index 7ca1e3e..cc42e88 100644 --- a/NativeLauncher/util/path_manager.cc +++ b/NativeLauncher/util/path_manager.cc @@ -39,14 +39,13 @@ typedef struct DllPath { std::vector extra_dirs; } DllPath; -static DllPath* __dllPath = NULL; +static DllPath* __dllPath = nullptr; static std::string __tpa; // on success, return 0. otherwise return -1. int initializePathManager(const std::string& runtimeDir, const std::string& tizenFXDir, const std::string& extraDir) { - - __dllPath = (DllPath*)calloc(sizeof(DllPath), 1); + __dllPath = new DllPath(); if (!__dllPath) { fprintf(stderr, "fail to allocate memory for dll path structure\n"); return -1; @@ -90,7 +89,7 @@ int initializePathManager(const std::string& runtimeDir, const std::string& tize void finalizePathManager() { if (__dllPath) { - free(__dllPath); + delete __dllPath; __dllPath = NULL; } }