Skip to contentSkip to conversation

secilc/secilcheck: Remove extra sepol_policydb_free(pdb)

PATCH In review James Carter 2 participants 3 messages Jun 4 – Jun 5 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 secilc/secilcheck: Remove extra sepol_policydb_free(pdb)

Since sepol_policydb_free() gets called at the end regardless, do not need to call it in the error path.

---
 secilc/secilcheck.c | 1 -
 1 file changed, 1 deletion(-)
secilc/secilcheck.c +0 -1
index bf12a812..a2cfd9e2 100644
@@ -78,7 +78,6 @@ static int get_binary_policy_db(const char *filename, sepol_policydb_t *pdb)
 
 	if (sepol_policydb_read(pdb, pf) < 0) {
 		fprintf(stderr, "Error reading binary policy: %s\n", filename);
-		sepol_policydb_free(pdb);
 		rc = SEPOL_ERR;
 		goto exit;
 	}
Signature · 1 line
2.54.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · James Carter

Since sepol_policydb_free() gets called at the end regardless, do not need to call it in the error path.

Quoted 20 lines
---
 secilc/secilcheck.c | 1 -
 1 file changed, 1 deletion(-)
secilc/secilcheck.c +0 -2
index bf12a812..a2cfd9e2 100644
@@ -78,7 +78,6 @@ static int get_binary_policy_db(const char *filename, sepol_policydb_t *pdb)
 
        if (sepol_policydb_read(pdb, pf) < 0) {
                fprintf(stderr, "Error reading binary policy: %s\n", filename);
-               sepol_policydb_free(pdb);
                rc = SEPOL_ERR;
                goto exit;
        }
--

2.54.0

#2 lore raw
Quoted 10 lines · Stephen Smalley
Quoted 5 lines · James Carter

Since sepol_policydb_free() gets called at the end regardless, do not need to call it in the error path.

Merged.
Jim

Quoted 20 lines
Quoted 20 lines
---
 secilc/secilcheck.c | 1 -
 1 file changed, 1 deletion(-)
secilc/secilcheck.c +0 -2
index bf12a812..a2cfd9e2 100644
@@ -78,7 +78,6 @@ static int get_binary_policy_db(const char *filename, sepol_policydb_t *pdb)
 
        if (sepol_policydb_read(pdb, pf) < 0) {
                fprintf(stderr, "Error reading binary policy: %s\n", filename);
-               sepol_policydb_free(pdb);
                rc = SEPOL_ERR;
                goto exit;
        }
--

2.54.0