All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] Memory leak in scripts/dtc/util.c
@ 2014-02-27 18:24 ` xypron.glpk
  0 siblings, 0 replies; 9+ messages in thread
From: xypron.glpk-Mmb7MZpHnFY @ 2014-02-27 18:24 UTC (permalink / raw)
  To: grant.likely-QSEj5FYQhm4dnm+yROfE0A
  Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Heinrich Schuchardt

From: Heinrich Schuchardt <xypron.glpk-Mmb7MZpHnFY@public.gmane.org>

buf was leaked if out of memory

Signed-off-by: Heinrich Schuchardt <xypron.glpk-Mmb7MZpHnFY@public.gmane.org>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-03-03 13:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-27 18:24 [PATCH 1/1] Memory leak in scripts/dtc/util.c xypron.glpk-Mmb7MZpHnFY
2014-02-27 18:24 ` xypron.glpk
2014-02-28  1:32 ` Rob Herring
     [not found]   ` <CAL_JsqK9Wquv6kgefyPvy0JqXNO7Cx2+iN_ss=CtgXnKEjrF-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-03-01  8:11     ` [PATCH 1/1] Remove dead code in util.c xypron.glpk-Mmb7MZpHnFY
2014-03-01  8:11       ` xypron.glpk
     [not found]       ` <1393661507-7197-1-git-send-email-xypron.glpk-Mmb7MZpHnFY@public.gmane.org>
2014-03-02 13:11         ` David Gibson
2014-03-02 13:11           ` David Gibson
2014-03-01  8:41     ` Incomplete information in MAINTAINERS Heinrich Schuchardt
     [not found]       ` <53119D3B.3050406-Mmb7MZpHnFY@public.gmane.org>
2014-03-03 13:26         ` Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.