libsepol: free potential transition tables on insertion failure
PATCH 1/1 libsepol: free potential transition tables on insertion failure
If the insertion via the callback insertf fails, free the potential previously allocated transition hashtables.
Signed-off-by Christian Göttsche <[email protected]>
--- libsepol/src/avtab.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
libsepol/src/avtab.c +6 -1
@@ -715,7 +715,12 @@ int avtab_read_item(struct policy_file *fp, uint32_t vers, avtab_t * a, } datum.data =le32_to_cpu (*buf32); } -return insertf (a, &key, &datum, p); + + rc =insertf (a, &key, &datum, p); +if (rc <0 ) +avtab_trans_destroy (&trans); + +return rc; } static int avtab_insertf(avtab_t * a, avtab_key_t * k, avtab_datum_t * d,
Signature · 1 line
2.40.1
Quoted 28 lines · Christian Göttsche
If the insertion via the callback insertf fails, free the potential previously allocated transition hashtables.
Signed-off-by Christian Göttsche <[email protected]>--- libsepol/src/avtab.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)libsepol/src/avtab.c +6
-2@@ -715,7 +715,12 @@ int avtab_read_item(struct policy_file *fp, uint32_t vers, avtab_t * a, } datum.data =le32_to_cpu (*buf32); } -return insertf (a, &key, &datum, p); + + rc =insertf (a, &key, &datum, p); +if (rc <0 ) +avtab_trans_destroy (&trans); + +return rc; } static int avtab_insertf(avtab_t * a, avtab_key_t * k, avtab_datum_t * d, --
Quoted 2 lines
2.40.1
This patch depended on the prefix/suffix patches which have been reverted. Jim