diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gram.y | 3 | ||||
-rw-r--r-- | src/session.c | 13 |
2 files changed, 4 insertions, 12 deletions
@@ -652,8 +652,7 @@ button : BUTTON number { $$ = $2; } ; -string : STRING { ptr = malloc(strlen($1)+1); - strcpy(ptr, $1); +string : STRING { ptr = strdup($1); RemoveDQuote(ptr); $$ = ptr; } 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 } |