summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/smbd/process.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 8b15ac88f9..defedf6d6c 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -1315,12 +1315,17 @@ static void smb_dump(const char *name, int type, const char *data)
len = smb_len_tcp(data)+4;
for (i=1;i<100;i++) {
- if (asprintf(&fname, "/tmp/%s.%d.%s", name, i,
- type ? "req" : "resp") == -1) {
+ fname = talloc_asprintf(talloc_tos(),
+ "/tmp/%s.%d.%s",
+ name,
+ i,
+ type ? "req" : "resp");
+ if (fname == NULL) {
return;
}
fd = open(fname, O_WRONLY|O_CREAT|O_EXCL, 0644);
if (fd != -1 || errno != EEXIST) break;
+ TALLOC_FREE(fname);
}
if (fd != -1) {
ssize_t ret = write(fd, data, len);
@@ -1329,7 +1334,7 @@ static void smb_dump(const char *name, int type, const char *data)
close(fd);
DEBUG(0,("created %s len %lu\n", fname, (unsigned long)len));
}
- SAFE_FREE(fname);
+ TALLOC_FREE(fname);
}
/****************************************************************************