summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/HPM.c27
-rw-r--r--src/common/mutex.c2
-rw-r--r--src/common/socket.c14
-rw-r--r--src/common/sysinfo.c2
-rw-r--r--src/common/timer.c1
-rw-r--r--src/common/utils.c2
6 files changed, 27 insertions, 21 deletions
diff --git a/src/common/HPM.c b/src/common/HPM.c
index 51a595310..92b9702d4 100644
--- a/src/common/HPM.c
+++ b/src/common/HPM.c
@@ -844,12 +844,13 @@ void hpm_memdown(void) {
/* this memory is handled outside of the server's memory manager and thus cleared after memory manager goes down */
- for( i = 0; i < HPM->fnamec; i++ ) {
- free(HPM->fnames[i].name);
- }
-
- if( HPM->fnames )
+ if (HPM->fnames)
+ {
+ for( i = 0; i < HPM->fnamec; i++ ) {
+ free(HPM->fnames[i].name);
+ }
free(HPM->fnames);
+ }
}
int hpm_arg_db_clear_sub(DBKey key, DBData *data, va_list args) {
struct HPMArgData *a = DB->data2ptr(data);
@@ -863,19 +864,21 @@ void hpm_final(void) {
HPM->off = true;
- for( i = 0; i < HPM->plugin_count; i++ ) {
- HPM->unload(HPM->plugins[i]);
- }
-
if( HPM->plugins )
+ {
+ for( i = 0; i < HPM->plugin_count; i++ ) {
+ HPM->unload(HPM->plugins[i]);
+ }
aFree(HPM->plugins);
-
- for( i = 0; i < HPM->symbol_count; i++ ) {
- aFree(HPM->symbols[i]);
}
if( HPM->symbols )
+ {
+ for( i = 0; i < HPM->symbol_count; i++ ) {
+ aFree(HPM->symbols[i]);
+ }
aFree(HPM->symbols);
+ }
for( i = 0; i < hpPHP_MAX; i++ ) {
if( HPM->packets[i] )
diff --git a/src/common/mutex.c b/src/common/mutex.c
index 31202d440..7307f5f15 100644
--- a/src/common/mutex.c
+++ b/src/common/mutex.c
@@ -94,7 +94,7 @@ void ramutex_lock(ramutex *m) {
bool ramutex_trylock(ramutex *m) {
#ifdef WIN32
- if(TryEnterCriticalSection(&m->hMutex) == TRUE)
+ if(TryEnterCriticalSection(&m->hMutex) != FALSE)
return true;
return false;
diff --git a/src/common/socket.c b/src/common/socket.c
index 09521c312..c0864c9b3 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -633,14 +633,16 @@ static void delete_session(int fd)
aFree(session[fd]->wdata);
if( session[fd]->session_data )
aFree(session[fd]->session_data);
- for(i = 0; i < session[fd]->hdatac; i++) {
- if( session[fd]->hdata[i]->flag.free ) {
- aFree(session[fd]->hdata[i]->data);
- }
- aFree(session[fd]->hdata[i]);
- }
if( session[fd]->hdata )
+ {
+ for(i = 0; i < session[fd]->hdatac; i++) {
+ if( session[fd]->hdata[i]->flag.free ) {
+ aFree(session[fd]->hdata[i]->data);
+ }
+ aFree(session[fd]->hdata[i]);
+ }
aFree(session[fd]->hdata);
+ }
aFree(session[fd]);
session[fd] = NULL;
}
diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c
index 605256100..ee8ff504a 100644
--- a/src/common/sysinfo.c
+++ b/src/common/sysinfo.c
@@ -594,7 +594,7 @@ void sysinfo_osversion_retrieve(void) {
// Include service pack (if any) and build number.
- if (strlen(osvi.szCSDVersion) > 0) {
+ if (osvi.szCSDVersion[0] != '\0') {
StrBuf->Printf(&buf, " %s", osvi.szCSDVersion);
}
diff --git a/src/common/timer.c b/src/common/timer.c
index f2bfa98b3..45dbb9f50 100644
--- a/src/common/timer.c
+++ b/src/common/timer.c
@@ -260,6 +260,7 @@ static int acquire_timer(void) {
// check available space
if( tid >= timer_data_num )
+ // possible timer_data null pointer
for (tid = timer_data_num; tid < timer_data_max && timer_data[tid].type; tid++);
if (tid >= timer_data_num && tid >= timer_data_max)
{// expand timer array
diff --git a/src/common/utils.c b/src/common/utils.c
index d73aab066..f4e261222 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -134,7 +134,7 @@ void findfile(const char *p, const char *pat, void (func)(const char*))
sprintf(tmppath,"%s%c%s",path,PATHSEP,FindFileData.cFileName);
- if (FindFileData.cFileName && strstr(FindFileData.cFileName, pattern)) {
+ if (strstr(FindFileData.cFileName, pattern)) {
func( tmppath );
}