diff options
| author | Pádraig Brady <P@draigBrady.com> | 2025-11-08 10:32:14 +0000 |
|---|---|---|
| committer | Pádraig Brady <P@draigBrady.com> | 2025-11-08 10:41:48 +0000 |
| commit | cc38da00ef98f270e263dfe3188b2035f9b27c8a (patch) | |
| tree | 997546fdee96b9841556b5239187b67a41513365 | |
| parent | tests: avoid false failure due to small timeout (diff) | |
| download | coreutils-cc38da00ef98f270e263dfe3188b2035f9b27c8a.tar.gz coreutils-cc38da00ef98f270e263dfe3188b2035f9b27c8a.zip | |
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
| -rw-r--r-- | src/chcon.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/chcon.c b/src/chcon.c index f118820cc..5f13c7d75 100644 --- a/src/chcon.c +++ b/src/chcon.c @@ -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); } |
