diff options
author | mckay <mckay@FreeBSD.org> | 2004-01-26 04:27:22 +0000 |
---|---|---|
committer | mckay <mckay@FreeBSD.org> | 2004-01-26 04:27:22 +0000 |
commit | 30265b4adbf6e5ce8ce37bc2377ce42342ccf594 (patch) | |
tree | 1ad0b620a9c574391085d7bc7e5456d2ee9f016a | |
parent | 78c458d45ccc8a8c92dc8b54e02c615202746e86 (diff) | |
download | FreeBSD-src-30265b4adbf6e5ce8ce37bc2377ce42342ccf594.zip FreeBSD-src-30265b4adbf6e5ce8ce37bc2377ce42342ccf594.tar.gz |
Use malloc() instead of alloca() to allocate a (potentially) large buffer
for storing the "diff -n" output. Some files (eg ports/INDEX,v) are too
big nowadays to fit on the stack.
Submitted by: Stephen Montgomery-Smith <stephen@math.missouri.edu>
-rw-r--r-- | usr.sbin/ctm/mkCTM/mkctm.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.sbin/ctm/mkCTM/mkctm.c b/usr.sbin/ctm/mkCTM/mkctm.c index 196a510..d2c73e2 100644 --- a/usr.sbin/ctm/mkCTM/mkctm.c +++ b/usr.sbin/ctm/mkCTM/mkctm.c @@ -218,7 +218,7 @@ Equ(const char *dir1, const char *dir2, const char *name, struct dirent *de) { u_long l = s2.st_size + 2; u_char *cmd = alloca(strlen(buf1)+strlen(buf2)+100); - u_char *ob = alloca(l), *p; + u_char *ob = malloc(l), *p; int j; FILE *F; @@ -292,6 +292,7 @@ Equ(const char *dir1, const char *dir2, const char *name, struct dirent *de) s_sub_files++; s_sub_bytes += s2.st_size; } + free(ob); } finish: munmap(p1, s1.st_size); |