This repository was archived by the owner on Aug 31, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -124,13 +124,14 @@ char *MCS_resolvepath(const char *path)
124124 pw = getpwnam (tpath + 1 );
125125 if (pw == NULL )
126126 return NULL ;
127- tildepath = new (nothrow) char [strlen (pw->pw_dir ) + strlen (tptr) + 2 ];
127+ tildepath = static_cast <char *>(malloc (sizeof (*tildepath) *
128+ (strlen (pw->pw_dir ) + strlen (tptr) + 2 )));
128129 strcpy (tildepath, pw->pw_dir );
129130 if (*tptr) {
130131 strcat (tildepath, " /" );
131132 strcat (tildepath, tptr);
132133 }
133- delete tpath;
134+ free ( tpath) ;
134135 }
135136 else
136137 tildepath = strclone (path);
@@ -150,11 +151,11 @@ char *MCS_resolvepath(const char *path)
150151 char *newname = new (nothrow) char [PATH_MAX + 2 ];
151152
152153 if ((size = readlink (tildepath, newname, PATH_MAX)) < 0 ) {
153- delete tildepath;
154- delete newname;
154+ free ( tildepath) ;
155+ delete[] newname;
155156 return NULL ;
156157 }
157- delete tildepath;
158+ free ( tildepath) ;
158159 newname[size] = ' \0 ' ;
159160 if (newname[0 ] != ' /' ) {
160161 char *fullpath = new (nothrow) char [strlen (path) + strlen (newname) + 2 ];
@@ -165,9 +166,9 @@ char *MCS_resolvepath(const char *path)
165166 else
166167 sptr++;
167168 strcpy (sptr, newname);
168- delete newname;
169+ delete[] newname;
169170 newname = MCS_resolvepath (fullpath);
170- delete fullpath;
171+ delete[] fullpath;
171172 }
172173 return newname;
173174}
You can’t perform that action at this time.
0 commit comments