]> gitweb.michael.orlitzky.com - apply-default-acl.git/commitdiff
src/libadacl.c: fix a memory leak found by clang-tidy. v0.4.0
authorMichael Orlitzky <michael@orlitzky.com>
Thu, 29 Mar 2018 01:59:51 +0000 (21:59 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Thu, 29 Mar 2018 02:00:54 +0000 (22:00 -0400)
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

index cdd07fcfee7c7400256e9ea619cc6abea99a195d..f20d4a393c26f4e22a8e1cb77947214539b6fb5e 100644 (file)
@@ -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) {