fdtoverlay: Switch from using alloca to malloc
alloca entails a complicated header situation when using other platforms, where some split it out in alloca.h while others include it as a standard part of stdlib.h. The cons don't seem to outweigh the pros, so switch it to malloc. Signed-off-by: Kyle Evans <kevans@FreeBSD.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
c8d5472de3
commit
a1fe86f380
1 changed files with 2 additions and 2 deletions
|
@ -26,7 +26,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <alloca.h>
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
#include <libfdt.h>
|
#include <libfdt.h>
|
||||||
|
@ -79,7 +78,7 @@ static int do_fdtoverlay(const char *input_filename,
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
/* allocate blob pointer array */
|
/* allocate blob pointer array */
|
||||||
ovblob = alloca(sizeof(*ovblob) * argc);
|
ovblob = malloc(sizeof(*ovblob) * argc);
|
||||||
memset(ovblob, 0, sizeof(*ovblob) * argc);
|
memset(ovblob, 0, sizeof(*ovblob) * argc);
|
||||||
|
|
||||||
/* read and keep track of the overlay blobs */
|
/* read and keep track of the overlay blobs */
|
||||||
|
@ -121,6 +120,7 @@ out_err:
|
||||||
if (ovblob[i])
|
if (ovblob[i])
|
||||||
free(ovblob[i]);
|
free(ovblob[i]);
|
||||||
}
|
}
|
||||||
|
free(ovblob);
|
||||||
}
|
}
|
||||||
free(blob);
|
free(blob);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue