From: Dmytro Shytyi Date: Wed, 29 Jan 2025 13:52:20 +0000 (+0100) Subject: lib: call to 'calloc' has an allocation size of 0 bytes X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=83de17ca9b9718c95461b2d6794994a27964037f;p=matthieu%2Ffrr.git 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 --- 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;