diff mbox

[2/5] libsepol: verify the right variable after calling calloc()

Message ID 20170115130359.6108-2-nicolas.iooss@m4x.org (mailing list archive)
State Not Applicable
Headers show

Commit Message

Nicolas Iooss Jan. 15, 2017, 1:03 p.m. UTC
After "otype = calloc(1, sizeof(*otype))", it is reasonable to check the
value of otype, not ft.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
---
 libsepol/src/policydb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/libsepol/src/policydb.c b/libsepol/src/policydb.c
index 3f9b1f3fd2ac..5b9b9f02f0b5 100644
--- a/libsepol/src/policydb.c
+++ b/libsepol/src/policydb.c
@@ -2558,7 +2558,7 @@  int filename_trans_read(policydb_t *p, struct policy_file *fp)
 		if (!ft)
 			goto err;
 		otype = calloc(1, sizeof(*otype));
-		if (!ft)
+		if (!otype)
 			goto err;
 		rc = next_entry(buf, fp, sizeof(uint32_t));
 		if (rc < 0)