From fc9ce0845e857c567d0a05627d3c672a35093abf Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Fri, 1 Apr 2016 18:12:46 +0200 Subject: [PATCH] python plugin: malloc + memset -> calloc --- src/python.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/python.c b/src/python.c index b9090249..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; -- 2.30.2