diff options
author | Alan Coopersmith <alan.coopersmith@sun.com> | 2008-01-28 15:54:55 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@sun.com> | 2008-01-28 15:54:55 -0800 |
commit | 673fd4184c005909db20035006f6b98eb6210bd4 (patch) | |
tree | 1b241751de4cd0b7768d6ad086d90355fafaba8f /sys.c | |
parent | 9ca1cdabb4f04cc7e8c437b48821f0672f58af60 (diff) |
Replace malloc/strcpy pairs with strdup
Diffstat (limited to 'sys.c')
-rw-r--r-- | sys.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -361,12 +361,11 @@ allocatePty(int *pty_return, char **line_return) close(pty); goto bsd; } - line = malloc(strlen(temp_line) + 1); + line = strdup(temp_line); if(!line) { close(pty); return -1; } - strcpy(line, temp_line); fix_pty_perms(line); @@ -394,8 +393,9 @@ allocatePty(int *pty_return, char **line_return) goto bail; found: - line = malloc(strlen(name) + 1); - strcpy(line, name); + line = strdup(name); + if(!line) + goto bail; line[5] = 't'; fix_pty_perms(line); *pty_return = pty; |