From: Ruben Kerkhof Date: Fri, 1 Apr 2016 16:12:46 +0000 (+0200) Subject: python plugin: malloc + memset -> calloc X-Git-Tag: collectd-5.6.0~371^2~19 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=fc9ce0845e857c567d0a05627d3c672a35093abf;p=collectd.git python plugin: malloc + memset -> calloc --- 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;