char* lpTempPath;
char* lpPipePath;
lpTempPath = GetKnownPath(KNOWN_PATH_TEMP);
+ if (!lpTempPath)
+ return NULL;
lpPipePath = GetCombinedPath(lpTempPath, ".pipe");
free(lpTempPath);
return lpPipePath;
char* lpPipePath;
lpTempPath = GetKnownPath(KNOWN_PATH_TEMP);
+ if (!lpTempPath)
+ return NULL;
lpPipePath = GetCombinedPath(lpTempPath, ".device");
free(lpTempPath);
return path;
home = GetPath_HOME();
+ if (!home)
+ return NULL;
path = (char*) malloc(strlen(home) + strlen("/.local/share") + 1);
+ if (!path)
+ {
+ free(home);
+ return NULL;
+ }
sprintf(path, "%s%s", home, "/.local/share");
free(home);
if (!home)
home = GetPath_TEMP();
+ if (!home)
+ return NULL;
+
path = (char*) malloc(strlen(home) + strlen("/.config") + 1);
if (!path)
{
if(pthread_mutex_init(&thread->mutex, 0) != 0)
{
WLog_ERR(TAG, "failed to initialize thread mutex");
- close(thread->pipe_fd[0]);
+ if (thread->pipe_fd[0])
+ close(thread->pipe_fd[0]);
+ if (thread->pipe_fd[1])
+ close(thread->pipe_fd[1]);
free(thread);
return NULL;
}
if (!thread_list)
{
WLog_ERR(TAG, "Couldn't create global thread list");
- close(thread->pipe_fd[0]);
+ if (thread->pipe_fd[0])
+ close(thread->pipe_fd[0]);
+ if (thread->pipe_fd[1])
+ close(thread->pipe_fd[1]);
free(thread);
return NULL;
}
if (!pubSub)
return NULL;
- pubSub->synchronized = synchronized;
+ pubSub->synchronized = synchronized;
- if (pubSub->synchronized)
- if (!InitializeCriticalSectionAndSpinCount(&pubSub->lock, 4000))
- {
- free(pubSub);
- return NULL;
- }
+ if (pubSub->synchronized && !InitializeCriticalSectionAndSpinCount(&pubSub->lock, 4000))
+ {
+ free(pubSub);
+ return NULL;
+ }
- pubSub->count = 0;
- pubSub->size = 64;
+ pubSub->count = 0;
+ pubSub->size = 64;
- pubSub->events = (wEventType*) calloc(1, sizeof(wEventType) * pubSub->size);
+ pubSub->events = (wEventType*) calloc(1, sizeof(wEventType) * pubSub->size);
if (!pubSub->events)
{
if (pubSub->synchronized)
log = (wLog*) calloc(1, sizeof(wLog));
if (!log)
- return 0;
+ return NULL;
log->Name = _strdup(name);
{
DWORD index;
wLog* child = NULL;
- wLog* root = WLog_GetRoot();
+ wLog* root = g_RootLog;
if (!root)
return;