X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fpython.c;h=1f808496b6eaa71621ec7076a8ae933388eaeb39;hb=f14bb45d570e0b34bdd3a2a0cadfe414c3dfda40;hp=bcf23588527ddf0cb14bdc6849414fd2218d6a86;hpb=b758f3b7146f1497d93e1df64cbc0c14ae164768;p=collectd.git diff --git a/src/python.c b/src/python.c index bcf23588..1f808496 100644 --- a/src/python.c +++ b/src/python.c @@ -552,10 +552,9 @@ static PyObject *cpy_register_generic(cpy_callback_t **list_head, PyObject *args Py_INCREF(callback); Py_XINCREF(data); - c = malloc(sizeof(*c)); + c = calloc(1, sizeof(*c)); if (c == NULL) return NULL; - memset (c, 0, sizeof (*c)); c->name = strdup(buf); c->callback = callback; @@ -644,10 +643,9 @@ static PyObject *cpy_register_generic_userdata(void *reg, void *handler, PyObjec Py_INCREF(callback); Py_XINCREF(data); - c = malloc(sizeof(*c)); + c = calloc(1, sizeof(*c)); if (c == NULL) return NULL; - memset (c, 0, sizeof (*c)); c->name = strdup(buf); c->callback = callback; @@ -683,10 +681,9 @@ static PyObject *cpy_register_read(PyObject *self, PyObject *args, PyObject *kwd Py_INCREF(callback); Py_XINCREF(data); - c = malloc(sizeof(*c)); + c = calloc(1, sizeof(*c)); if (c == NULL) return NULL; - memset (c, 0, sizeof (*c)); c->name = strdup(buf); c->callback = callback; @@ -1050,7 +1047,7 @@ PyMODINIT_FUNC PyInit_collectd(void) { } #endif -static int cpy_init_python() { +static int cpy_init_python(void) { PyObject *sys; PyObject *module;