[BUG] halog: fix segfault in case of empty log in PCT mode

This commit is contained in:
Willy Tarreau 2009-11-17 10:16:19 +01:00
parent f0e0d65abb
commit fe362fe476
1 changed files with 4 additions and 1 deletions

View File

@ -674,6 +674,9 @@ int main(int argc, char **argv)
unsigned long cum[5]; unsigned long cum[5];
double step; double step;
if (!tot)
goto empty;
for (f = 1; f < 5; f++) { for (f = 1; f < 5; f++) {
n[f] = eb32_first(&timers[f]); n[f] = eb32_first(&timers[f]);
cum[f] = container_of(n[f], struct timer, node)->count; cum[f] = container_of(n[f], struct timer, node)->count;
@ -706,7 +709,7 @@ int main(int argc, char **argv)
step += 1; step += 1;
} }
} }
empty:
if (!(filter & FILT_QUIET)) if (!(filter & FILT_QUIET))
fprintf(stderr, "%d lines in, %d lines out, %d parsing errors\n", fprintf(stderr, "%d lines in, %d lines out, %d parsing errors\n",
linenum, tot, parse_err); linenum, tot, parse_err);