From a5d23c3d91c9a7b16e5aec08555133f9ded7d1bb Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 28 Mar 2018 21:59:51 -0400 Subject: [PATCH] src/libadacl.c: fix a memory leak found by clang-tidy. There was an error path in apply_default_acl() that was returning directly rather than jumping to the cleanup function where memory is freed. Thanks, clang-tidy. --- src/libadacl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libadacl.c b/src/libadacl.c index cdd07fc..f20d4a3 100644 --- a/src/libadacl.c +++ b/src/libadacl.c @@ -1025,7 +1025,8 @@ int apply_default_acl(const char* path, bool recursive) { basename_path_copy = strdup(path); if (basename_path_copy == NULL) { perror("apply_default_acl (strdup)"); - return ACL_ERROR; + result = ACL_ERROR; + goto cleanup; } fd = openat(parent_fd, basename(basename_path_copy), O_NOFOLLOW); if (fd == OPEN_ERROR) { -- 2.43.2