Fixup memstats for pretty time print in log file.

git-svn-id: file:///svn/unbound/trunk@1834 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2009-09-16 13:01:51 +00:00
parent 795a25c117
commit 90b4b1dae9
2 changed files with 8 additions and 9 deletions

View file

@ -1,5 +1,6 @@
16 September 2009: Wouter
- Fix memory leak reported by Tao Ma.
- Fix memstats test tool for log-time-ascii log format.
15 September 2009: Wouter
- iana portlist updated.

View file

@ -83,17 +83,15 @@ match(char* line)
* But now also:
* Sep 16 15:18:20 unbound[17428:0] info: ul/nh.c:143 memdup malloc(11)
*/
if(strlen(line) < 36) /* up to 'info: ' */
if(strlen(line) < 32) /* up to 'info: ' */
return 0;
if(strncmp(line+30, "info: ", 6) != 0 &&
strncmp(line+33, "info: ", 6) != 0)
if(!strstr(line, "] info: "))
return 0;
if(strncmp(line+36, "stat ", 5) == 0 ||
strncmp(line+39, "stat ", 5) == 0)
if(strstr(line, "info: stat"))
return 0; /* skip the hex dumps */
if(strstr(line+36, "malloc("))
if(strstr(line+30, "malloc("))
return 1;
else if(strstr(line+36, "calloc("))
else if(strstr(line+30, "calloc("))
return 1;
/* skip reallocs */
return 0;
@ -203,9 +201,9 @@ readfile(rbtree_t* tree, const char* fname)
if(!match(buf))
continue;
else if(strstr(buf+36, "malloc("))
else if(strstr(buf+30, "malloc("))
read_malloc_stat(buf, tree);
else if(strstr(buf+36, "calloc("))
else if(strstr(buf+30, "calloc("))
read_calloc_stat(buf, tree);
else {
printf("%s\n", buf);