From: Willy Tarreau Date: Tue, 17 Nov 2009 09:16:19 +0000 (+0100) Subject: [BUG] halog: fix segfault in case of empty log in PCT mode X-Git-Tag: v1.3.23~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe362fe4762151d209b9656639ee1651bc2b329d;p=thirdparty%2Fhaproxy.git [BUG] halog: fix segfault in case of empty log in PCT mode --- diff --git a/contrib/halog/halog.c b/contrib/halog/halog.c index 27e09617db..6a515567c5 100644 --- a/contrib/halog/halog.c +++ b/contrib/halog/halog.c @@ -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);