@@ -67,8 +67,10 @@ static void skel(const char *homedir) {
67
67
if (asprintf (& fname , "%s/.zshrc" , homedir ) == -1 )
68
68
errExit ("asprintf" );
69
69
// don't copy it if we already have the file
70
- if (access (fname , F_OK ) == 0 )
70
+ if (access (fname , F_OK ) == 0 ) {
71
+ free (fname );
71
72
return ;
73
+ }
72
74
if (is_link (fname )) { // access(3) on dangling symlinks fails, try again using lstat
73
75
fprintf (stderr , "Error: invalid %s file\n" , fname );
74
76
exit (1 );
@@ -91,8 +93,10 @@ static void skel(const char *homedir) {
91
93
if (asprintf (& fname , "%s/.cshrc" , homedir ) == -1 )
92
94
errExit ("asprintf" );
93
95
// don't copy it if we already have the file
94
- if (access (fname , F_OK ) == 0 )
96
+ if (access (fname , F_OK ) == 0 ) {
97
+ free (fname );
95
98
return ;
99
+ }
96
100
if (is_link (fname )) { // access(3) on dangling symlinks fails, try again using lstat
97
101
fprintf (stderr , "Error: invalid %s file\n" , fname );
98
102
exit (1 );
@@ -115,8 +119,10 @@ static void skel(const char *homedir) {
115
119
if (asprintf (& fname , "%s/.bashrc" , homedir ) == -1 )
116
120
errExit ("asprintf" );
117
121
// don't copy it if we already have the file
118
- if (access (fname , F_OK ) == 0 )
122
+ if (access (fname , F_OK ) == 0 ) {
123
+ free (fname );
119
124
return ;
125
+ }
120
126
if (is_link (fname )) { // access(3) on dangling symlinks fails, try again using lstat
121
127
fprintf (stderr , "Error: invalid %s file\n" , fname );
122
128
exit (1 );
0 commit comments