]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: stats: allocate the stats frontend also on "stats bind-process"
authorWilly Tarreau <w@1wt.eu>
Sat, 20 Apr 2013 07:48:50 +0000 (09:48 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 20 Apr 2013 07:48:50 +0000 (09:48 +0200)
Bryan Talbot reported that a config with only "stats bind-process 1" in
the global section would crash during parsing. This bug was introduced
with this new statement in 1.5-dev13. The stats frontend must be allocated
if it was not yet.

No backport is needed. The workaround consists in having previously declared
any other stats keyword (generally stats socket).

src/dumpstats.c

index 17efeff0a65f3c6eefc46c4e71e528c613696d69..25f54416c29d2ec00012284cd2bdf209e2085061 100644 (file)
@@ -337,6 +337,13 @@ static int stats_parse_global(char **args, int section_type, struct proxy *curpx
                int cur_arg = 2;
                unsigned int set = 0;
 
+               if (!global.stats_fe) {
+                       if ((global.stats_fe = alloc_stats_fe("GLOBAL", file, line)) == NULL) {
+                               memprintf(err, "'%s %s' : out of memory trying to allocate a frontend", args[0], args[1]);
+                               return -1;
+                       }
+               }
+
                while (*args[cur_arg]) {
                        unsigned int low, high;