From: Michael Orlitzky Date: Thu, 29 Mar 2018 01:59:51 +0000 (-0400) Subject: src/libadacl.c: fix a memory leak found by clang-tidy. X-Git-Tag: v0.4.0^0 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=a5d23c3d91c9a7b16e5aec08555133f9ded7d1bb;p=apply-default-acl.git 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. --- 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) {