[1/5] dtc: Implement and use an xstrdup() function

Jon Loeliger jdl at jdl.com
Sat Oct 4 03:17:27 EST 2008


> Many places in dtc use strdup(), but none of them actually check the
> return value to see if the implied allocation succeeded.  This is a
> potential bug, which we fix in the patch below by replacing strdup()
> with an xstrdup() which in analogy to xmalloc() will quit with a fatal
> error if the allocation fails.
> 
> xstrdup() is defined in srcpos.c, because that's available to both dtc
> itself and the conversion program which also uses it.  While we're at
> it, we add standard double-include protection to srcpos.h which was
> missing it.
> 
> Signed-off-by: David Gibson <david at gibson.dropbear.id.au>


This was applied with a minor change, placing the new function
in the file util.h and util.c instead.  New patch posted.

Thanks,
jdl




More information about the devicetree-discuss mailing list