From 879e4d2590b50d63f82c3c3652bc3c7900591f1c Mon Sep 17 00:00:00 2001 From: Jon Loeliger Date: Fri, 3 Oct 2008 11:12:33 -0500 Subject: Implement and use an xstrdup() function 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. This patch is a re-factoring of Dave Gibson's similar patch. Signed-off-by: Jon Loeliger --- dtc.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'dtc.h') diff --git a/dtc.h b/dtc.h index 08d54c8..5ead895 100644 --- a/dtc.h +++ b/dtc.h @@ -34,7 +34,10 @@ #include #include +#include "util.h" + #define DEFAULT_FDT_VERSION 17 + /* * Command line options */ -- cgit v1.2.1