fix s->st_size being potentially garbage

This commit is contained in:
Amadeusz Sławiński
2017-01-09 12:56:46 +01:00
committed by Amadeusz Sławiński
parent 6f03f0ea3e
commit 8e1fe11cee

View File

@@ -142,9 +142,9 @@ Log *logfopen(char *name, FILE * fp)
return l;
}
if (!(l = malloc(sizeof(Log))))
if (!(l = calloc(1, sizeof(Log))))
return NULL;
if (!(l->st = malloc(sizeof(struct stat)))) {
if (!(l->st = calloc(1, sizeof(struct stat)))) {
free((char *)l);
return NULL;
}