1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-20 10:51:48 +02:00

chcon: fix memory leak in error path

* src/chcon.c (change_file_context): If compute_context_from_mask fails,
free the previously allocated file_context.
Fixes https://bugs.gnu.org/79780
This commit is contained in:
Pádraig Brady
2025-11-08 10:32:14 +00:00
parent cc88c2a807
commit cc38da00ef

View File

@@ -168,7 +168,10 @@ change_file_context (int fd, char const *file)
}
if (compute_context_from_mask (file_context, &context))
return 1;
{
freecon (file_context);
return 1;
}
context_string = context_str (context);
}