summaryrefslogtreecommitdiff
path: root/source4/lib/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/util.c')
-rw-r--r--source4/lib/util.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/source4/lib/util.c b/source4/lib/util.c
index d7c5661f7d..8b27bf070c 100644
--- a/source4/lib/util.c
+++ b/source4/lib/util.c
@@ -705,15 +705,18 @@ char *name_to_fqdn(TALLOC_CTX *mem_ctx, const char *name)
char *lock_path(TALLOC_CTX* mem_ctx, const char *name)
{
- char *fname;
+ char *fname, *dname;
- fname = talloc_strdup(mem_ctx, lp_lockdir());
- trim_string(fname,"","/");
+ dname = talloc_strdup(mem_ctx, lp_lockdir());
+ trim_string(dname,"","/");
- if (!directory_exist(fname,NULL))
- mkdir(fname,0755);
+ if (!directory_exist(dname,NULL)) {
+ mkdir(dname,0755);
+ }
- fname = talloc_asprintf(mem_ctx, "%s/%s", fname, name);
+ fname = talloc_asprintf(mem_ctx, "%s/%s", dname, name);
+
+ talloc_free(dname);
return fname;
}