diff options
Diffstat (limited to 'src/session.c')
-rw-r--r-- | src/session.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/session.c b/src/session.c index e5ffb61..e12a6c0 100644 --- a/src/session.c +++ b/src/session.c @@ -701,11 +701,7 @@ unique_filename ( snprintf (tempFile, sizeof(tempFile), "%s/%sXXXXXX", path, prefix); tmp = (char *) mktemp (tempFile); if (tmp) - { - char *ptr = malloc (strlen (tmp) + 1); - strcpy (ptr, tmp); - return (ptr); - } + return strdup (tmp); else return (NULL); #endif @@ -714,12 +710,9 @@ unique_filename ( char *ptr; snprintf (tempFile, sizeof(tempFile), "%s/%sXXXXXX", path, prefix); - ptr = malloc(strlen(tempFile) + 1); + ptr = strdup (tempFile); if (ptr != NULL) - { - strcpy(ptr, tempFile); - *pFd = mkstemp(ptr); - } + *pFd = mkstemp (ptr); return ptr; #endif } |