From e273b4e08ee0ebc1a001d60e2a5b65a9553a8a8a Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Tue, 29 Apr 2008 11:08:02 +0000 Subject: Fix another leak. --- src/rc/rc.c | 11 ++++++----- 1 file 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; } -- cgit v1.2.3