diff options
author | Jim Wilson <wilson@gcc.gnu.org> | 1996-10-01 11:18:44 -0700 |
---|---|---|
committer | Jim Wilson <wilson@gcc.gnu.org> | 1996-10-01 11:18:44 -0700 |
commit | 71591a1d691fd6529e7a889166646249bc5187c3 (patch) | |
tree | 23cf3bc55c9b0a5303b9279a7d7a045f090bd3f0 /gcc | |
parent | afad3d2c2608d4905fdb7446810ee826fb142501 (diff) | |
download | gcc-71591a1d691fd6529e7a889166646249bc5187c3.zip gcc-71591a1d691fd6529e7a889166646249bc5187c3.tar.gz gcc-71591a1d691fd6529e7a889166646249bc5187c3.tar.bz2 |
(used_arg): When call xmalloc for mswitches, pass 1 if
n_switches is zero.
From-SVN: r12885
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/gcc.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -4982,8 +4982,13 @@ used_arg (p, len) break; } - /* Now build a list of the replacement string for switches that we care about */ - mswitches = (struct mswitchstr *) xmalloc ((sizeof (struct mswitchstr)) * n_switches); + /* Now build a list of the replacement string for switches that we care + about. Make sure we allocate at least one entry. This prevents + xmalloc from calling fatal, and prevents us from re-executing this + block of code. */ + mswitches + = (struct mswitchstr *) xmalloc ((sizeof (struct mswitchstr)) + * (n_switches ? n_switches : 1)); for (i = 0; i < n_switches; i++) { int xlen = strlen (switches[i].part1); |