]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: check: test if server is not null in purge
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 9 Aug 2021 13:09:17 +0000 (15:09 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 9 Aug 2021 15:48:34 +0000 (17:48 +0200)
Test if server is not null before using free_server in the check purge
operation. Currently, the null server scenario should not occured as
purge is used with refcounted dynamic servers. However, this might not
be always the case if purge is use in the future in other cases; thus
the test is useful for extensibility.

No need to backport, unless dynamic server checks are backported.

This has been reported through a coverity report in github issue #1343.

src/check.c

index b49aca61a5843d8ddd4c46ea152e3309a3a18d3e..b1ffe5ecabf5fb3c187827f4de7484cfb57243c4 100644 (file)
@@ -1253,7 +1253,8 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state)
                task_destroy(check->task);
                t = NULL;
 
-               free_server(check->server);
+               if (check->server)
+                       free_server(check->server);
        }
 
        return t;