Skip to content

Commit 45fdf23

Browse files
committed
libselinux: Close old selabel handle when setting a new one
In selinux_restorecon_set_sehandle(), close the old selabel handle (if it exists) before setting the new one. Signed-off-by: James Carter <[email protected]> Acked-by: Petr Lautrbach <[email protected]>
1 parent fb8c507 commit 45fdf23

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

libselinux/src/selinux_restorecon.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,6 +1367,10 @@ void selinux_restorecon_set_sehandle(struct selabel_handle *hndl)
13671367
unsigned char *fc_digest;
13681368
size_t num_specfiles, fc_digest_len;
13691369

1370+
if (fc_sehandle) {
1371+
selabel_close(fc_sehandle);
1372+
}
1373+
13701374
fc_sehandle = hndl;
13711375
if (!fc_sehandle)
13721376
return;

0 commit comments

Comments
 (0)