aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2025-07-10 11:18:47 +0530
committerRaghuram Subramani <raghus2247@gmail.com>2025-07-10 11:18:47 +0530
commit564591aa8c2cc455a8fd69a1a2a00786448f2b17 (patch)
treece8146da613c1d5992f6a3ceed1db8a84e1178e8 /src
parentbcddd5c79306fcd7949c47f64d08400205463beb (diff)
main: fclose(in) if out is NULL
Diffstat (limited to 'src')
-rw-r--r--src/main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 8e06dd9..f404545 100644
--- a/src/main.c
+++ b/src/main.c
@@ -53,15 +53,15 @@ handle_file(const char *path)
free(temp_outpath);
FILE *in = fopen(inpath, "r");
- FILE *out = fopen(outpath, "w");
-
if (in == NULL) {
printf("Failed to open %s\n", inpath);
return;
}
+ FILE *out = fopen(outpath, "w");
if (out == NULL) {
printf("Failed to open %s\n", outpath);
+ fclose(in);
return;
}