Fix up potential overflows in size calculations by replacing instances
[pspp] / src / pfm-write.c
index be9812c5b365ca26724f16eb5910abd5138c4b2a..c3562f34c437b594ca16f99c48b14ff4915f80ef 100644 (file)
@@ -129,7 +129,7 @@ pfm_open_writer (struct file_handle *fh, struct dictionary *dict,
   w->vars = NULL;
   
   w->var_cnt = dict_get_var_cnt (dict);
-  w->vars = xmalloc (sizeof *w->vars * w->var_cnt);
+  w->vars = xnmalloc (w->var_cnt, sizeof *w->vars);
   for (i = 0; i < w->var_cnt; i++) 
     {
       const struct variable *dv = dict_get_var (dict, i);