]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
daemon: Use correct argument order for calloc() to fix compiler warning
authorTobias Brunner <tobias@strongswan.org>
Fri, 12 Jul 2024 12:00:15 +0000 (14:00 +0200)
committerTobias Brunner <tobias@strongswan.org>
Fri, 12 Jul 2024 12:00:15 +0000 (14:00 +0200)
The number of elements is the first argument, their size the second.
The previous code triggered the following warning:

  'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument

src/libcharon/daemon.c

index fca66480143cfdcdc0cd667bf5376feba729ee1f..c48fa0a6f0aa5865a1183f52b2c3b5f90cec14b3 100644 (file)
@@ -652,7 +652,7 @@ METHOD(daemon_t, set_default_loggers, void,
        {
                if (!this->levels)
                {
-                       this->levels = calloc(sizeof(level_t), DBG_MAX);
+                       this->levels = calloc(DBG_MAX, sizeof(level_t));
                }
                for (group = 0; group < DBG_MAX; group++)
                {