aboutsummaryrefslogtreecommitdiff
path: root/src/rc/rc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rc/rc.c')
-rw-r--r--src/rc/rc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/rc/rc.c b/src/rc/rc.c
index 35e0bdd9..94292870 100644
--- a/src/rc/rc.c
+++ b/src/rc/rc.c
@@ -733,17 +733,18 @@ static void do_newlevel(const char *newlevel)
static bool runlevel_config(const char *service, const char *level)
{
char *init = rc_service_resolve(service);
- char *conf;
+ char *conf, *dir;
size_t l;
bool retval;
- init = dirname(init);
- init = dirname(init);
- l = strlen(init) + strlen(level) + strlen(service) + 10;
+ dir = dirname(init);
+ dir = dirname(init);
+ l = strlen(dir) + strlen(level) + strlen(service) + 10;
conf = xmalloc(sizeof(char) * l);
- snprintf(conf, l, "%s/conf.d/%s.%s", init, service, level);
+ snprintf(conf, l, "%s/conf.d/%s.%s", dir, service, level);
retval = exists(conf);
free(conf);
+ free(init);
return retval;
}