[PATCH 3/5] libsepol: free ebitmap in filename_trans_comp_read_one()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ebitmap_read() might fail in between, but always calls ebitmap_init(),
so ebitmap_destopy() is safe to call.

Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>
---
 libsepol/src/avtab.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libsepol/src/avtab.c b/libsepol/src/avtab.c
index 7b85519b..9c7daf8e 100644
--- a/libsepol/src/avtab.c
+++ b/libsepol/src/avtab.c
@@ -912,7 +912,7 @@ static int filename_trans_comp_read_one(avtab_t *a, void *fp)
 	for (i = 0; i < ndatum; i++) {
 		rc = ebitmap_read(&stypes, fp);
 		if (rc < 0)
-			goto err;
+			goto err_ebitmap;
 
 		rc = next_entry(buf, fp, sizeof(uint32_t));
 		if (rc < 0)
@@ -928,6 +928,8 @@ static int filename_trans_comp_read_one(avtab_t *a, void *fp)
 			if (rc < 0)
 				goto err_ebitmap;
 		}
+
+		ebitmap_destroy(&stypes);
 	}
 
 	free(name);
-- 
2.40.1




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux