aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNicolas Iooss <nicolas.iooss_linux@m4x.org>2017-03-04 14:26:45 +0100
committerDavid Gibson <david@gibson.dropbear.id.au>2017-03-06 14:19:26 +1100
commitd922ecdd017bc4bc81864714b0427b22de594ae5 (patch)
tree14a9e8214b3c57966f0e13defda0fd8c4eca762e /tests
parent921cc17fec295ce46720437cb064d0a6abf298e1 (diff)
downloaddtc-d922ecdd017bc4bc81864714b0427b22de594ae5.zip
dtc-d922ecdd017bc4bc81864714b0427b22de594ae5.tar.gz
dtc-d922ecdd017bc4bc81864714b0427b22de594ae5.tar.bz2
tests: Make realloc_fdt() really allocate *fdt
This bug has been found by using clang Static Analyzer: it reported that the value stored to fdt was never read. Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tests')
-rw-r--r--tests/sw_tree1.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/sw_tree1.c b/tests/sw_tree1.c
index 6d4c531..4887dc3 100644
--- a/tests/sw_tree1.c
+++ b/tests/sw_tree1.c
@@ -42,14 +42,14 @@ static void realloc_fdt(void **fdt, size_t *size, bool created)
switch (alloc_mode) {
case FIXED:
if (!(*fdt))
- fdt = xmalloc(*size);
+ *fdt = xmalloc(*size);
else
FAIL("Ran out of space");
return;
case RESIZE:
if (!(*fdt)) {
- fdt = xmalloc(SPACE);
+ *fdt = xmalloc(SPACE);
} else if (*size < SPACE) {
*size += 1;
fdt_resize(*fdt, *fdt, *size);