On Fri, Oct 03, 2008 at 12:15:08PM -0500, Jon Loeliger wrote:
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.
I felt the introduciton of util.[ch] was a better choice
for utility oriented code than directly using srcpos.c
for the new string function.
Fair enough. Now that we have a util.c, we should move die() and
xmalloc() in there as well which are currently duplicated between dtc
and convert-dtsv0.
This patch is a re-factoring of Dave Gibson's similar patch.
Signed-off-by: Jon Loeliger <redacted>
Acked-by: David Gibson <redacted>
--
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