diff options
Diffstat (limited to 'src/firejail/checkcfg.c')
-rw-r--r-- | src/firejail/checkcfg.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/firejail/checkcfg.c b/src/firejail/checkcfg.c index 963d95bed..974fbb8a3 100644 --- a/src/firejail/checkcfg.c +++ b/src/firejail/checkcfg.c | |||
@@ -32,6 +32,7 @@ char *netfilter_default = NULL; | |||
32 | int checkcfg(int val) { | 32 | int checkcfg(int val) { |
33 | assert(val < CFG_MAX); | 33 | assert(val < CFG_MAX); |
34 | int line = 0; | 34 | int line = 0; |
35 | FILE *fp = NULL; | ||
35 | 36 | ||
36 | if (!initialized) { | 37 | if (!initialized) { |
37 | // initialize defaults | 38 | // initialize defaults |
@@ -47,7 +48,7 @@ int checkcfg(int val) { | |||
47 | if (asprintf(&fname, "%s/firejail.config", SYSCONFDIR) == -1) | 48 | if (asprintf(&fname, "%s/firejail.config", SYSCONFDIR) == -1) |
48 | errExit("asprintf"); | 49 | errExit("asprintf"); |
49 | 50 | ||
50 | FILE *fp = fopen(fname, "r"); | 51 | fp = fopen(fname, "r"); |
51 | if (!fp) { | 52 | if (!fp) { |
52 | #ifdef HAVE_GLOBALCFG | 53 | #ifdef HAVE_GLOBALCFG |
53 | fprintf(stderr, "Error: Firejail configuration file %s not found\n", fname); | 54 | fprintf(stderr, "Error: Firejail configuration file %s not found\n", fname); |
@@ -285,6 +286,8 @@ int checkcfg(int val) { | |||
285 | return cfg_val[val]; | 286 | return cfg_val[val]; |
286 | 287 | ||
287 | errout: | 288 | errout: |
289 | if (fp) | ||
290 | fclose(fp); | ||
288 | fprintf(stderr, "Error: invalid line %d in firejail configuration file\n", line ); | 291 | fprintf(stderr, "Error: invalid line %d in firejail configuration file\n", line ); |
289 | exit(1); | 292 | exit(1); |
290 | } | 293 | } |