diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2012-11-19 20:19:39 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2012-12-01 16:38:32 +0100 |
commit | 6f862a69ecc9ca92899047d2cb0bbdd72513a3cf (patch) | |
tree | 00b88c4372cfac6106153fb026eca8f9fe905718 | |
parent | de892aea1c486b59e04884268b612081d1660514 (diff) |
cgls: automatic cleanup
-rw-r--r-- | src/cgls/cgls.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/cgls/cgls.c b/src/cgls/cgls.c index b2cd968e46..ad59c0127f 100644 --- a/src/cgls/cgls.c +++ b/src/cgls/cgls.c @@ -138,7 +138,7 @@ int main(int argc, char *argv[]) { } } else { - char *p; + char _cleanup_free_ *p; p = get_current_dir_name(); if (!p) { @@ -150,7 +150,7 @@ int main(int argc, char *argv[]) { printf("Working Directory %s:\n", p); r = show_cgroup_by_path(p, NULL, 0, arg_kernel_threads, arg_all); } else { - char *root = NULL; + char _cleanup_free_ *root = NULL; const char *t = NULL; r = cg_get_by_pid(SYSTEMD_CGROUP_CONTROLLER, 1, &root); @@ -164,10 +164,7 @@ int main(int argc, char *argv[]) { } r = show_cgroup(SYSTEMD_CGROUP_CONTROLLER, t, NULL, 0, arg_kernel_threads, arg_all); - free(root); } - - free(p); } if (r < 0) |