]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: fix calloc warning on recent compiler 16958/head
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Mon, 30 Sep 2024 14:31:56 +0000 (11:31 -0300)
committerRafael Zalamena <rzalamena@opensourcerouting.org>
Mon, 30 Sep 2024 14:31:56 +0000 (11:31 -0300)
Fix the following compiler warning:
```
lib/elf_py.c: In function _elffile_load_:
lib/elf_py.c:1310:34: warning: _calloc_ sizes specified with _sizeof_ in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
 1310 |         w->sects = calloc(sizeof(PyObject *), w->ehdr->e_shnum);
      |                                  ^~~~~~~~
lib/elf_py.c:1310:34: note: earlier argument should specify number of elements, later size of each element
```

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
lib/elf_py.c

index 2b4fea373f036770d2d52defc30987ff547394e1..6c63d1f892023153401ccdcc5a285a558f9ffed2 100644 (file)
@@ -1307,7 +1307,7 @@ static PyObject *elffile_load(PyTypeObject *type, PyObject *args,
        }
 #endif
 
-       w->sects = calloc(sizeof(PyObject *), w->ehdr->e_shnum);
+       w->sects = calloc(w->ehdr->e_shnum, sizeof(PyObject *));
        w->n_sect = w->ehdr->e_shnum;
 
        return (PyObject *)w;