utilfdt_read_err: use xmalloc funcs

We've got these handy helpers, so let's use them.

Acked-by: David Gibson <David@gibson.dropbear.id.au>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
Mike Frysinger 2013-04-10 14:29:06 -04:00 committed by Jon Loeliger
parent 27cdc1b16f
commit f8cb5dd949

4
util.c
View file

@ -212,12 +212,12 @@ int utilfdt_read_err(const char *filename, char **buffp)
} }
/* Loop until we have read everything */ /* Loop until we have read everything */
buf = malloc(bufsize); buf = xmalloc(bufsize);
do { do {
/* Expand the buffer to hold the next chunk */ /* Expand the buffer to hold the next chunk */
if (offset == bufsize) { if (offset == bufsize) {
bufsize *= 2; bufsize *= 2;
buf = realloc(buf, bufsize); buf = xrealloc(buf, bufsize);
if (!buf) { if (!buf) {
ret = ENOMEM; ret = ENOMEM;
break; break;