From: Heinrich Schuchardt <[email protected]>
buf was leaked if out of memory
Signed-off-by: Heinrich Schuchardt <[email protected]>
---
scripts/dtc/util.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/dtc/util.c b/scripts/dtc/util.c
index 2422c34..a1e2e59 100644
--- a/scripts/dtc/util.c
+++ b/scripts/dtc/util.c
@@ -210,9 +210,11 @@ int utilfdt_read_err(const char *filename, char **buffp)
do {
/* Expand the buffer to hold the next chunk */
if (offset == bufsize) {
+ char *buf_old = buf;
bufsize *= 2;
buf = realloc(buf, bufsize);
if (!buf) {
+ buf = buf_old;
ret = ENOMEM;
break;
}
--
1.7.10.4
On Thu, Feb 27, 2014 at 12:24 PM, <[email protected]> wrote:
> From: Heinrich Schuchardt <[email protected]>
>
> buf was leaked if out of memory
>
> Signed-off-by: Heinrich Schuchardt <[email protected]>
> ---
> scripts/dtc/util.c | 2 ++
> 1 file changed, 2 insertions(+)
This needs to be made against upstream dtc repo (on kernel.org now).
Also, there is a newly created list for dtc specific topics:
http://vger.kernel.org/vger-lists.html#devicetree-compiler
Rob
>
> diff --git a/scripts/dtc/util.c b/scripts/dtc/util.c
> index 2422c34..a1e2e59 100644
> --- a/scripts/dtc/util.c
> +++ b/scripts/dtc/util.c
> @@ -210,9 +210,11 @@ int utilfdt_read_err(const char *filename, char **buffp)
> do {
> /* Expand the buffer to hold the next chunk */
> if (offset == bufsize) {
> + char *buf_old = buf;
> bufsize *= 2;
> buf = realloc(buf, bufsize);
> if (!buf) {
> + buf = buf_old;
> ret = ENOMEM;
> break;
> }
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html