[PATCH 2/3] libsepol: fix potential memory leak in common_copy_callback

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

 



In common_copy_callback(), destroy new_common->permissions when the function fails.

Signed-off-by: Jie Lu <lujie54@xxxxxxxxxx>
---
 libsepol/src/expand.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libsepol/src/expand.c b/libsepol/src/expand.c
index 8d19850e..b44cfd4f 100644
--- a/libsepol/src/expand.c
+++ b/libsepol/src/expand.c
@@ -297,6 +297,7 @@ static int common_copy_callback(hashtab_key_t key, hashtab_datum_t datum,
 			   (hashtab_datum_t) new_common);
 	if (ret) {
 		ERR(state->handle, "hashtab overflow");
+		symtab_destroy(&new_common->permissions);
 		free(new_common);
 		free(new_id);
 		return -1;
-- 
2.27.0




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

  Powered by Linux