use utils::strdup() for duplicating strings

This commit is contained in:
Axel Kohlmeyer
2021-03-15 15:31:25 -04:00
parent a6a2879807
commit ece2433208
6 changed files with 21 additions and 54 deletions

View File

@ -154,11 +154,8 @@ void AtomVec::store_args(int narg, char **arg)
nargcopy = narg;
if (nargcopy) argcopy = new char*[nargcopy];
else argcopy = nullptr;
for (int i = 0; i < nargcopy; i++) {
int n = strlen(arg[i]) + 1;
argcopy[i] = new char[n];
strcpy(argcopy[i],arg[i]);
}
for (int i = 0; i < nargcopy; i++)
argcopy[i] = utils::strdup(arg[i]);
}
/* ----------------------------------------------------------------------