Fixes to Coverity defects.

This commit is contained in:
Markus Makela
2015-05-22 05:36:58 +03:00
parent 9f024b5389
commit 9c461450e2
3 changed files with 5 additions and 2 deletions

View File

@ -73,7 +73,6 @@ MONITOR *mon;
LOGFILE_ERROR, LOGFILE_ERROR,
"Error : Unable to load monitor module '%s'.", "Error : Unable to load monitor module '%s'.",
name))); name)));
free(mon->name);
free(mon); free(mon);
return NULL; return NULL;
} }

View File

@ -229,8 +229,9 @@ void mon_append_node_names(MONITOR_SERVERS* start,char* str, int len)
{ {
MONITOR_SERVERS* ptr = start; MONITOR_SERVERS* ptr = start;
bool first = true; bool first = true;
int slen = strlen(str);
while(ptr) while(ptr && slen < len)
{ {
if(!first) if(!first)
{ {
@ -239,6 +240,7 @@ void mon_append_node_names(MONITOR_SERVERS* start,char* str, int len)
first = false; first = false;
strncat(str,ptr->server->unique_name,len); strncat(str,ptr->server->unique_name,len);
ptr = ptr->next; ptr = ptr->next;
slen = strlen(str);
} }
} }

View File

@ -123,6 +123,8 @@ startMonitor(void *arg,void* opt)
return NULL; return NULL;
handle->shutdown = 0; handle->shutdown = 0;
handle->id = MONITOR_DEFAULT_ID; handle->id = MONITOR_DEFAULT_ID;
handle->script = NULL;
handle->master = NULL;
memset(handle->events,false,sizeof(handle->events)); memset(handle->events,false,sizeof(handle->events));
spinlock_init(&handle->lock); spinlock_init(&handle->lock);
} }