Use correct argument order for pool_nmalloc.
authorJohn Darrington <john@darrington.wattle.id.au>
Fri, 27 Sep 2013 12:21:08 +0000 (14:21 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Fri, 27 Sep 2013 12:21:08 +0000 (14:21 +0200)
This function (and other calloc-like functions) are may not take zero as the size argument.  Hence
the order is important.  Reported by Przemek Powalko <pp.alter.ego@gmail.com>

src/data/sys-file-reader.c

index 5b654a1c0577e3b42e3bdeb5c2d40a077b357f21..681e6f531b152a61cc8b7a030893fe715a2c063a 100644 (file)
@@ -1747,7 +1747,7 @@ parse_value_labels (struct sfm_reader *r, struct dictionary *dict,
   char **utf8_labels;
   size_t i;
 
-  utf8_labels = pool_nmalloc (r->pool, sizeof *utf8_labels, record->n_labels);
+  utf8_labels = pool_nmalloc (r->pool, record->n_labels, sizeof *utf8_labels);
   for (i = 0; i < record->n_labels; i++)
     utf8_labels[i] = recode_string_pool ("UTF-8", dict_get_encoding (dict),
                                          record->labels[i].label, -1,