diff --git a/gen.c b/gen.c index 40f0cc48..02f89fc0 100644 --- a/gen.c +++ b/gen.c @@ -811,6 +811,7 @@ static char **read_source_file(char *file) { fstat(fileno(fp), &st); char *buf = malloc(st.st_size + 1); if (fread(buf, 1, st.st_size, fp) != st.st_size) { + free(buf); fclose(fp); return NULL; }