summaryrefslogtreecommitdiff
path: root/src/core/cgroup.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-03-22 06:01:04 +0100
committerLennart Poettering <lennart@poettering.net>2013-03-22 15:46:49 +0100
commit8e70580bb07ae46dc0b0bf377de6333540668acc (patch)
treebccf33eb6f1dc3d04495b4843abf8e54604b986a /src/core/cgroup.c
parenta652755d2e8c2ddb31eb281f4585a3edbb333338 (diff)
cgroup: minor optimization
Diffstat (limited to 'src/core/cgroup.c')
-rw-r--r--src/core/cgroup.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 4790a09ff2..8fb2952c16 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -438,7 +438,7 @@ int cgroup_bonding_get(Manager *m, const char *cgroup, CGroupBonding **bonding)
return 1;
}
- p = strdup(cgroup);
+ p = strdupa(cgroup);
if (!p)
return -ENOMEM;
@@ -446,8 +446,7 @@ int cgroup_bonding_get(Manager *m, const char *cgroup, CGroupBonding **bonding)
char *e;
e = strrchr(p, '/');
- if (!e || e == p) {
- free(p);
+ if (e == p || !e) {
*bonding = NULL;
return 0;
}
@@ -456,7 +455,6 @@ int cgroup_bonding_get(Manager *m, const char *cgroup, CGroupBonding **bonding)
b = hashmap_get(m->cgroup_bondings, p);
if (b) {
- free(p);
*bonding = b;
return 1;
}