DSDebug: null check after getenv and strdup 20/242320/1
authorjeon <jhyuni.kang@samsung.com>
Tue, 25 Aug 2020 01:47:27 +0000 (10:47 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Tue, 25 Aug 2020 12:37:37 +0000 (21:37 +0900)
Change-Id: I9f82aa12b71c95b930958be6d30d04d1e9bfa232

src/DSDebug/DSDebugLog.cpp

index 3966335..bd579df 100644 (file)
 
 namespace display_server
 {
-DSDebugLog::DSDebugLog() : mLogLevel(LOG_LEVEL_DEBUG)
+DSDebugLog::DSDebugLog() : mLogLevel(LOG_LEVEL_DEBUG), __enableDlog(false)
 {
        char *tmp = getenv("DSLOG_DLOG_ENABLE");
+       if (!tmp) return;
+
        char *env = strdup(tmp);
+       if (!env) return;
+
        int value = atoi(env);
 
        free(env);
 
        if (value == 1)
                __enableDlog = true;
-       else
-               __enableDlog = false;
 }
 
 DSDebugLog::~DSDebugLog()