use new operation instead of calloc to avoid crash 74/183674/1
authorWoongsuk Cho <ws77.cho@samsung.com>
Tue, 10 Jul 2018 01:17:08 +0000 (10:17 +0900)
committerWoongsuk Cho <ws77.cho@samsung.com>
Tue, 10 Jul 2018 01:17:08 +0000 (10:17 +0900)
Change-Id: I6cc0995be7fb08737ce47aa8712f5883ae072e70

NativeLauncher/util/path_manager.cc

index 7ca1e3e..cc42e88 100644 (file)
@@ -39,14 +39,13 @@ typedef struct DllPath {
        std::vector <std::string>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;
        }
 }