X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdaemon%2Futils_tail.c;h=a6fb600597d98621619af2451caca31e54675add;hb=ae634791d387f8a98d1bd0c4c3fa06f912be04cd;hp=fe5dca89b891ef3b8c874b2ee7cb8d414e172409;hpb=ca4a6c8a856a9012270ec10389b08d54e70e3401;p=collectd.git diff --git a/src/daemon/utils_tail.c b/src/daemon/utils_tail.c index fe5dca89..a6fb6005 100644 --- a/src/daemon/utils_tail.c +++ b/src/daemon/utils_tail.c @@ -45,10 +45,9 @@ static int cu_tail_reopen (cu_tail_t *obj) { int seek_end = 0; FILE *fh; - struct stat stat_buf; + struct stat stat_buf = { 0 }; int status; - memset (&stat_buf, 0, sizeof (stat_buf)); status = stat (obj->file, &stat_buf); if (status != 0) { @@ -119,10 +118,9 @@ cu_tail_t *cu_tail_create (const char *file) { cu_tail_t *obj; - obj = (cu_tail_t *) malloc (sizeof (cu_tail_t)); + obj = calloc (1, sizeof (*obj)); if (obj == NULL) return (NULL); - memset (obj, '\0', sizeof (cu_tail_t)); obj->file = strdup (file); if (obj->file == NULL)