From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jon Loeliger Subject: Re: [1/5] dtc: Implement and use an xstrdup() function Date: Fri, 03 Oct 2008 12:17:27 -0500 Message-ID: References: <20081002140427.GD11662@yookeroo.seuss> <20081002140512.GE11662@yookeroo.seuss> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-reply-to: <20081002140512.GE11662-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-mnsaURCQ41sdnm+yROfE0A@public.gmane.org Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-mnsaURCQ41sdnm+yROfE0A@public.gmane.org To: David Gibson Cc: devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org List-Id: devicetree@vger.kernel.org > 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 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