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>main
parent
921cc17fec
commit
d922ecdd01
|
@ -42,14 +42,14 @@ static void realloc_fdt(void **fdt, size_t *size, bool created)
|
||||||
switch (alloc_mode) {
|
switch (alloc_mode) {
|
||||||
case FIXED:
|
case FIXED:
|
||||||
if (!(*fdt))
|
if (!(*fdt))
|
||||||
fdt = xmalloc(*size);
|
*fdt = xmalloc(*size);
|
||||||
else
|
else
|
||||||
FAIL("Ran out of space");
|
FAIL("Ran out of space");
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case RESIZE:
|
case RESIZE:
|
||||||
if (!(*fdt)) {
|
if (!(*fdt)) {
|
||||||
fdt = xmalloc(SPACE);
|
*fdt = xmalloc(SPACE);
|
||||||
} else if (*size < SPACE) {
|
} else if (*size < SPACE) {
|
||||||
*size += 1;
|
*size += 1;
|
||||||
fdt_resize(*fdt, *fdt, *size);
|
fdt_resize(*fdt, *fdt, *size);
|
||||||
|
|
Loading…
Reference in New Issue