Fixed double free
This commit is contained in:
@@ -32,13 +32,13 @@ int copyhtml(FILE *in, FILE *out) {
|
|||||||
addspace = 0;
|
addspace = 0;
|
||||||
c = fgetc(in);
|
c = fgetc(in);
|
||||||
if (c == EOF)
|
if (c == EOF)
|
||||||
return 0;
|
goto end;
|
||||||
if (isspace(c)) {
|
if (isspace(c)) {
|
||||||
addspace = 1;
|
addspace = 1;
|
||||||
while (isspace(c)) {
|
while (isspace(c)) {
|
||||||
c = fgetc(in);
|
c = fgetc(in);
|
||||||
if (c == EOF)
|
if (c == EOF)
|
||||||
return 0;
|
goto end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (c == '<' || c == '>') {
|
if (c == '<' || c == '>') {
|
||||||
@@ -52,5 +52,7 @@ int copyhtml(FILE *in, FILE *out) {
|
|||||||
fputc(c, out);
|
fputc(c, out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
end:
|
||||||
|
fclose(in);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,14 +67,12 @@ int main(int argc, char **argv) {
|
|||||||
fputs("Failed to copy header\n", stderr);
|
fputs("Failed to copy header\n", stderr);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
fclose(headerfile);
|
|
||||||
}
|
}
|
||||||
if (template != NULL) {
|
if (template != NULL) {
|
||||||
FILE *templatefile;
|
FILE *templatefile;
|
||||||
templatefile = fopen(template, "r");
|
templatefile = fopen(template, "r");
|
||||||
if (parsetemplate(templatefile, outfile))
|
if (parsetemplate(templatefile, outfile))
|
||||||
return 1;
|
return 1;
|
||||||
fclose(templatefile);
|
|
||||||
}
|
}
|
||||||
if (footer != NULL) {
|
if (footer != NULL) {
|
||||||
FILE *footerfile;
|
FILE *footerfile;
|
||||||
@@ -83,7 +81,6 @@ int main(int argc, char **argv) {
|
|||||||
fputs("Failed to copy footer\n", stderr);
|
fputs("Failed to copy footer\n", stderr);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
fclose(footerfile);
|
|
||||||
}
|
}
|
||||||
if (outfile != stdout)
|
if (outfile != stdout)
|
||||||
fclose(outfile);
|
fclose(outfile);
|
||||||
|
|||||||
Reference in New Issue
Block a user