summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGuillem Jover <guillem@hadrons.org>2014-11-03 23:21:52 +0100
committerGuillem Jover <guillem@hadrons.org>2015-09-23 07:59:34 +0200
commit32388fe59f526a150058b58a8bc22785e4b6b4cc (patch)
treeb73f6201c389e4395d3a2700318f8e902f15f1b3 /test
parent30e328cbf14d03fc9f6569e93e0dac41526264d8 (diff)
Use reallocarray() instead of malloc() or realloc()
Diffstat (limited to 'test')
-rw-r--r--test/fgetln.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/fgetln.c b/test/fgetln.c
index 83d120c..d3814d8 100644
--- a/test/fgetln.c
+++ b/test/fgetln.c
@@ -149,7 +149,7 @@ test_fgetln_multi(void)
str = strdup("A\n");
str[0] += i;
- files[i].lines = malloc(sizeof(char *) * LINE_COUNT);
+ files[i].lines = reallocarray(NULL, LINE_COUNT, sizeof(char *));
files[i].lines[0] = str;
files[i].lines[1] = str;
files[i].fp = pipe_feed("%s", files[i].lines, LINE_COUNT);
@@ -211,7 +211,7 @@ test_fgetwln_multi(void)
wstr = wcsdup(L"A\n");
wstr[0] += i;
- files[i].lines = malloc(sizeof(char *) * LINE_COUNT);
+ files[i].lines = reallocarray(NULL, LINE_COUNT, sizeof(char *));
files[i].lines[0] = wstr;
files[i].lines[1] = wstr;
files[i].fp = pipe_feed("%ls", files[i].lines, LINE_COUNT);