X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdaemon%2Futils_tail.c;h=0d8ed7c177fcb2aa12e1c7cf9d9dc3fb88108a50;hb=a5377cf935630082f2eac2e5f4a538844cc06c8d;hp=fe5dca89b891ef3b8c874b2ee7cb8d414e172409;hpb=65c20e41cfad6e7ab024983f561835fd347124ce;p=collectd.git diff --git a/src/daemon/utils_tail.c b/src/daemon/utils_tail.c index fe5dca89..0d8ed7c1 100644 --- a/src/daemon/utils_tail.c +++ b/src/daemon/utils_tail.c @@ -31,6 +31,7 @@ **/ #include "collectd.h" + #include "common.h" #include "utils_tail.h" @@ -45,10 +46,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 +119,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)