diff options
| author | Dmytro Shytyi <dmytro.shytyi@6wind.com> | 2025-01-29 14:52:20 +0100 |
|---|---|---|
| committer | Dmytro Shytyi <dmytro.shytyi@6wind.com> | 2025-03-11 11:16:01 +0100 |
| commit | 83de17ca9b9718c95461b2d6794994a27964037f (patch) | |
| tree | b65c4d3170a80efc5a19d431a782f47bd6b9cc75 /lib/elf_py.c | |
| parent | 3f785c913d19175333e11af664a8dd558e47ba3e (diff) | |
lib: call to 'calloc' has an allocation size of 0 bytes
w->sects = calloc(sizeof(PyObject *), w->ehdr->e_shnum);
Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com>
Diffstat (limited to 'lib/elf_py.c')
| -rw-r--r-- | lib/elf_py.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/elf_py.c b/lib/elf_py.c index 6c63d1f892..14012a2173 100644 --- a/lib/elf_py.c +++ b/lib/elf_py.c @@ -1306,8 +1306,8 @@ static PyObject *elffile_load(PyTypeObject *type, PyObject *args, } } #endif - - w->sects = calloc(w->ehdr->e_shnum, sizeof(PyObject *)); + if (w->ehdr->e_shnum > 0) + w->sects = calloc(w->ehdr->e_shnum, sizeof(PyObject *)); w->n_sect = w->ehdr->e_shnum; return (PyObject *)w; |
