summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-07-16 19:08:22 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-07-16 19:08:22 +0000
commitb3e3ead648e88382123d02efd4effdcb426d6431 (patch)
tree64b2fb11799206ba4f0fec314d7889b29889bb6f
parent87104837f8d2f765f35a3562fdce090a5df732ca (diff)
When reallocing pattern, use sizeof(*pattern) not sizeof(int).
Fixes a problem on sparc64 where sizeof(int) != sizeof(pointer). Based on a patch from Brian Poole; tedu@ OK
-rw-r--r--usr.bin/grep/grep.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/grep/grep.c b/usr.bin/grep/grep.c
index 729d1a42408..d7c1e0e2ef0 100644
--- a/usr.bin/grep/grep.c
+++ b/usr.bin/grep/grep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grep.c,v 1.21 2003/07/14 23:22:35 millert Exp $ */
+/* $OpenBSD: grep.c,v 1.22 2003/07/16 19:08:21 millert Exp $ */
/*-
* Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
@@ -167,7 +167,7 @@ add_pattern(char *pat, size_t len)
}
if (patterns == pattern_sz) {
pattern_sz *= 2;
- pattern = grep_realloc(pattern, ++pattern_sz * sizeof(int));
+ pattern = grep_realloc(pattern, ++pattern_sz * sizeof(*pattern));
}
if (pat[len - 1] == '\n')
--len;
@@ -432,7 +432,7 @@ main(int argc, char *argv[])
else if (Fflag)
cflags |= REG_NOSPEC;
fg_pattern = grep_malloc(patterns * sizeof(*fg_pattern));
- r_pattern = grep_malloc(patterns * sizeof(regex_t));
+ r_pattern = grep_malloc(patterns * sizeof(*r_pattern));
for (i = 0; i < patterns; ++i) {
/* Check if cheating is allowed */
if (fastcomp(&fg_pattern[i], pattern[i])) {