diff options
author | kevans@FreeBSD.org <kevans@FreeBSD.org> | 2018-01-02 21:05:38 -0600 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2018-01-03 14:15:16 +1100 |
commit | a1fe86f380cbae3fb1aea85654d44637dd13d6c3 (patch) | |
tree | f2affac9dcb515466d00e2c6a41112df280a44f1 /fdtoverlay.c | |
parent | c8d5472de3ff24baa9f331b12ada43abc2058737 (diff) | |
download | dtc-a1fe86f380cbae3fb1aea85654d44637dd13d6c3.zip dtc-a1fe86f380cbae3fb1aea85654d44637dd13d6c3.tar.gz dtc-a1fe86f380cbae3fb1aea85654d44637dd13d6c3.tar.bz2 |
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>
Diffstat (limited to 'fdtoverlay.c')
-rw-r--r-- | fdtoverlay.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fdtoverlay.c b/fdtoverlay.c index 7f124fc..62a942d 100644 --- a/fdtoverlay.c +++ b/fdtoverlay.c @@ -26,7 +26,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <alloca.h> #include <inttypes.h> #include <libfdt.h> @@ -79,7 +78,7 @@ static int do_fdtoverlay(const char *input_filename, ret = 0; /* allocate blob pointer array */ - ovblob = alloca(sizeof(*ovblob) * argc); + ovblob = malloc(sizeof(*ovblob) * argc); memset(ovblob, 0, sizeof(*ovblob) * argc); /* read and keep track of the overlay blobs */ @@ -121,6 +120,7 @@ out_err: if (ovblob[i]) free(ovblob[i]); } + free(ovblob); } free(blob); |