Replaced the call to strdup() with a new operator followed by a strcpy().
authorJohn Criswell <criswell@uiuc.edu>
Wed, 17 Sep 2003 19:14:41 +0000 (19:14 +0000)
committerJohn Criswell <criswell@uiuc.edu>
Wed, 17 Sep 2003 19:14:41 +0000 (19:14 +0000)
This should prevent calls to the new oerator and malloc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8587 91177308-0d34-0410-b5e6-96231b3b80d8

tools/gccld/gccld.cpp

index c53378731828f1eb7ea9f0103f22ec494324ed10..608a67e6300dd6819743e138aaf3fc0204501738 100644 (file)
@@ -382,7 +382,8 @@ copy_env (char ** const envp)
   entries = 0;
   while (envp[entries] != NULL)
   {
-    newenv[entries] = strdup (envp[entries]);
+    newenv[entries] = new char[strlen (envp[entries]) + 1];
+    strcpy (newenv[entries], envp[entries]);
     ++entries;
   }
   newenv[entries] = NULL;