From 1efeddf31574c28ba41e02596e69e9669bd10268 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Sun, 21 Jun 2020 13:21:03 +0200 Subject: [PATCH] Fixed some calls to xcalloc where the quantity and size parameters had been transposed. --- src/libpspp/bit-vector.c | 3 ++- src/math/categoricals.c | 2 +- src/ui/gui/psppire-import-assistant.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libpspp/bit-vector.c b/src/libpspp/bit-vector.c index 2b98291523..79367248f0 100644 --- a/src/libpspp/bit-vector.c +++ b/src/libpspp/bit-vector.c @@ -25,7 +25,8 @@ unsigned long int * bitvector_allocate(size_t n) { - return xcalloc (sizeof (unsigned long int), DIV_RND_UP (n, BITS_PER_ULONG)); + return xcalloc (DIV_RND_UP (n, BITS_PER_ULONG), + sizeof (unsigned long int)); } size_t diff --git a/src/math/categoricals.c b/src/math/categoricals.c index eb28cb42bf..7e949fc718 100644 --- a/src/math/categoricals.c +++ b/src/math/categoricals.c @@ -480,7 +480,7 @@ categoricals_done (const struct categoricals *cat_) return; } - struct value_node **nodes = xcalloc (sizeof *nodes, n_vals); + struct value_node **nodes = xcalloc (n_vals, sizeof *nodes); int x = 0; struct value_node *valnd; HMAP_FOR_EACH (valnd, struct value_node, node, &vn->valmap) diff --git a/src/ui/gui/psppire-import-assistant.c b/src/ui/gui/psppire-import-assistant.c index ed8df0c9bc..88074bc7b7 100644 --- a/src/ui/gui/psppire-import-assistant.c +++ b/src/ui/gui/psppire-import-assistant.c @@ -1241,7 +1241,7 @@ textfile_create_reader (PsppireImportAssistant *ia) int i; - struct fmt_guesser **fg = xcalloc (sizeof *fg, n_vars); + struct fmt_guesser **fg = xcalloc (n_vars, sizeof *fg); for (i = 0 ; i < n_vars; ++i) { fg[i] = fmt_guesser_create (); -- 2.30.2