On Wed, Jun 8, 2022 at 2:03 PM James Carter <jwcart2@xxxxxxxxx> wrote: > > On Mon, May 23, 2022 at 4:10 AM Christian Göttsche > <cgzones@xxxxxxxxxxxxxx> wrote: > > > > sepolgen-ifgen-attr-helper.c: In function ‘load_policy’: > > sepolgen-ifgen-attr-helper.c:196:17: warning: leak of FILE ‘fp’ [CWE-775] [-Wanalyzer-file-leak] > > 196 | fprintf(stderr, "Out of memory!\n"); > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx> > > Acked-by: James Carter <jwcart2@xxxxxxxxx> > Merged. Thanks, Jim > > --- > > python/audit2allow/sepolgen-ifgen-attr-helper.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/python/audit2allow/sepolgen-ifgen-attr-helper.c b/python/audit2allow/sepolgen-ifgen-attr-helper.c > > index 6f3ba962..5e6cffc1 100644 > > --- a/python/audit2allow/sepolgen-ifgen-attr-helper.c > > +++ b/python/audit2allow/sepolgen-ifgen-attr-helper.c > > @@ -194,12 +194,14 @@ static policydb_t *load_policy(const char *filename) > > policydb = malloc(sizeof(policydb_t)); > > if (policydb == NULL) { > > fprintf(stderr, "Out of memory!\n"); > > + fclose(fp); > > return NULL; > > } > > > > if (policydb_init(policydb)) { > > fprintf(stderr, "Out of memory!\n"); > > free(policydb); > > + fclose(fp); > > return NULL; > > } > > > > @@ -208,6 +210,7 @@ static policydb_t *load_policy(const char *filename) > > fprintf(stderr, > > "error(s) encountered while parsing configuration\n"); > > free(policydb); > > + fclose(fp); > > return NULL; > > } > > > > -- > > 2.36.1 > >