[PATCH 1/8] utilfdt_read_err: use xmalloc funcs

David Gibson david at gibson.dropbear.id.au
Mon Apr 8 19:42:24 EST 2013


On Mon, Apr 08, 2013 at 03:06:45AM -0400, Mike Frysinger wrote:
> We've got these handy helpers, so let's use them.
> 
> Signed-off-by: Mike Frysinger <vapier at gentoo.org>

Acked-by: David Gibs on<David at gibson.dropbear.id.au>

> ---
>  util.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/util.c b/util.c
> index b081fa8..12f0614 100644
> --- a/util.c
> +++ b/util.c
> @@ -212,12 +212,12 @@ int utilfdt_read_err(const char *filename, char **buffp)
>  	}
>  
>  	/* Loop until we have read everything */
> -	buf = malloc(bufsize);
> +	buf = xmalloc(bufsize);
>  	do {
>  		/* Expand the buffer to hold the next chunk */
>  		if (offset == bufsize) {
>  			bufsize *= 2;
> -			buf = realloc(buf, bufsize);
> +			buf = xrealloc(buf, bufsize);
>  			if (!buf) {
>  				ret = ENOMEM;
>  				break;

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.ozlabs.org/pipermail/devicetree-discuss/attachments/20130408/6f16e6a9/attachment.sig>


More information about the devicetree-discuss mailing list