From 0834ff302264319097eb3f52295f5f671091cba9 Mon Sep 17 00:00:00 2001 From: Eric Paris Date: Wed, 23 Jan 2013 15:07:26 -0500 Subject: [PATCH] libselinux: do not leak file contexts with mmap'd backend We use strdup to store the intended context when we have an mmap'd file backend. We, however, skipped freeing those contexts. Signed-off-by: Eric Paris --- libselinux/src/label_file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libselinux/src/label_file.c b/libselinux/src/label_file.c index ddfe68c1..5f697f38 100644 --- a/libselinux/src/label_file.c +++ b/libselinux/src/label_file.c @@ -553,12 +553,12 @@ static void closef(struct selabel_handle *rec) for (i = 0; i < data->nspec; i++) { spec = &data->spec_arr[i]; + free(spec->lr.ctx_trans); + free(spec->lr.ctx_raw); if (spec->from_mmap) continue; free(spec->regex_str); free(spec->type_str); - free(spec->lr.ctx_raw); - free(spec->lr.ctx_trans); if (spec->regcomp) { pcre_free(spec->regex); pcre_free_study(spec->sd);