* g_malloc0 aborts the application if the specificed amount of memory
cannot be allocated. Hence, no need to have a NULL check for the
return value of g_malloc0.
* Removed one if block in VMToolsLogInt since the if check will never
be TRUE.
* g_strdup returns NULL if the input argument is NULL. Removed
the unnecessary NULL checks for the input argument to g_strdup at few
places.
data = data->inherited ? gDefaultData : data;
entry = g_malloc0(sizeof(LogEntry));
- if (entry) {
- entry->domain = domain ? g_strdup(domain) : NULL;
- if (domain && !entry->domain) {
- VMToolsLogPanic();
- }
- entry->handler = data;
- entry->level = level;
- }
+ entry->domain = g_strdup(domain);
+ entry->handler = data;
+ entry->level = level;
if (gLogIOSuspended && data->needsFileIO) {
if (gMaxCacheEntries == 0) {
logger->type = strdup(handler);
logger->needsFileIO = needsFileIO;
logger->isSysLog = isSysLog;
- logger->confData = (path != NULL ? g_strdup(path) : NULL);
+ logger->confData = g_strdup(path);
g_free(path);
return logger;