diff options
author | Jim Meyering <meyering@redhat.com> | 2010-01-18 07:53:44 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2010-01-18 12:03:06 +0100 |
commit | cd349fdca2f3368d1c2441a432dda2f064e4c455 (patch) | |
tree | 927eed72d6eb522760046fd68b340b42d2bae14e | |
parent | eccf54368f51b9492f1e744b66aeb56cea8706e9 (diff) | |
download | coreutils-cd349fdca2f3368d1c2441a432dda2f064e4c455.tar.xz |
pr: avoid two over-allocations
* src/pr.c (init_store_cols): Allocate N*sizeof(*VAR) bytes,
not N*sizeof(int*). The latter would mistakenly allocate double
the required space on a system with 8-byte pointers.
-rw-r--r-- | src/pr.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1915,10 +1915,10 @@ init_store_cols (void) free (line_vector); /* FIXME: here's where it was allocated. */ - line_vector = xmalloc ((total_lines + 1) * sizeof (int *)); + line_vector = xmalloc ((total_lines + 1) * sizeof *line_vector); free (end_vector); - end_vector = xmalloc (total_lines * sizeof (int *)); + end_vector = xmalloc (total_lines * sizeof *end_vector); free (buff); buff_allocated = (use_col_separator |