mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
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.
This commit is contained in:
1 parent
eccf54368f
commit
cd349fdca2
1 file changed
+2
-2
@@ -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
|
||||
|
||||
Reference in new issue
Block a user