From bb57593f14a5e9031c88154a4e86acb7484fcda4 Mon Sep 17 00:00:00 2001 From: yuqing Date: Thu, 14 Jan 2016 13:35:10 +0800 Subject: [PATCH] test_mblock ok --- src/system_info.c | 2 +- src/system_info.h | 2 +- src/tests/test_mblock.c | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/system_info.c b/src/system_info.c index 97957f8..898a042 100644 --- a/src/system_info.c +++ b/src/system_info.c @@ -436,7 +436,7 @@ int get_processes(struct fast_process_info **processes, int *count) break; } } - if (i < len) + if (i < len) //not digital string { continue; } diff --git a/src/system_info.h b/src/system_info.h index 664639d..513749f 100644 --- a/src/system_info.h +++ b/src/system_info.h @@ -48,7 +48,7 @@ extern "C" { #ifdef OS_LINUX typedef struct fast_process_info { - int field_count; + int field_count; //field count in /proc/$pid/stat int pid; char comm[128]; char state; diff --git a/src/tests/test_mblock.c b/src/tests/test_mblock.c index 2b42db6..419ef10 100644 --- a/src/tests/test_mblock.c +++ b/src/tests/test_mblock.c @@ -85,6 +85,7 @@ int main(int argc, char *argv[]) stats[i].f_ffree); } +#ifdef OS_LINUX { FastProcessInfo *processes; get_processes(&processes, &count); @@ -93,7 +94,12 @@ int main(int argc, char *argv[]) { printf("%d %d %c %s\n", processes[i].field_count, processes[i].pid, processes[i].state, processes[i].comm); } + if (processes != NULL) + { + free(processes); + } } +#endif //iniPrintItems(&iniContext); iniFreeContext(&iniContext);