@@ -469,18 +469,22 @@ ParseConfigFile(const char *config_file, const char *calling_file, bool strict,
469
469
(errcode_for_file_access (),
470
470
errmsg (" could not open configuration file\" %s\" : %m" ,
471
471
abs_path)));
472
- return false ;
472
+ OK =false ;
473
+ goto cleanup;
473
474
}
474
475
475
476
ereport (LOG,
476
477
(errmsg (" skipping missing configuration file\" %s\" " ,
477
478
abs_path)));
478
- return OK;
479
+ OK =true ;
480
+ goto cleanup;
479
481
}
480
482
481
483
OK =ParseConfigFp (fp, abs_path, depth, elevel, head_p, tail_p);
482
484
483
- FreeFile (fp);
485
+ cleanup:
486
+ if (fp)
487
+ FreeFile (fp);
484
488
pfree (abs_path);
485
489
486
490
return OK;
@@ -748,7 +752,8 @@ ParseConfigDirectory(const char *includedir,
748
752
(errcode_for_file_access (),
749
753
errmsg (" could not open configuration directory\" %s\" : %m" ,
750
754
directory)));
751
- return false ;
755
+ status =false ;
756
+ goto cleanup;
752
757
}
753
758
754
759
/*
@@ -803,7 +808,8 @@ ParseConfigDirectory(const char *includedir,
803
808
(errcode_for_file_access (),
804
809
errmsg (" could not stat file\" %s\" : %m" ,
805
810
filename)));
806
- return false ;
811
+ status =false ;
812
+ goto cleanup;
807
813
}
808
814
}
809
815
@@ -824,7 +830,9 @@ ParseConfigDirectory(const char *includedir,
824
830
status =true ;
825
831
826
832
cleanup:
827
- FreeDir (d);
833
+ if (d)
834
+ FreeDir (d);
835
+ pfree (directory);
828
836
return status;
829
837
}
830
838