]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] halog: fix segfault in case of empty log in PCT mode
authorWilly Tarreau <w@1wt.eu>
Tue, 17 Nov 2009 09:16:19 +0000 (10:16 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 28 Jan 2010 09:07:26 +0000 (10:07 +0100)
(cherry picked from commit fe362fe4762151d209b9656639ee1651bc2b329d)

contrib/halog/halog.c

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