Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!know!samsung!think!barmar From: barmar@think.com (Barry Margolin) Newsgroups: comp.lang.c Subject: Re: Memory Fault Keywords: help Message-ID: <40890@think.Think.COM> Date: 22 Jul 90 03:32:14 GMT References: <189@S5000.UUCP> Sender: news@Think.COM Organization: Thinking Machines Corporation, Cambridge MA, USA Lines: 14 In article <189@S5000.UUCP> gh@S5000.UUCP (Sys Admin) writes: > * CODE NOT TESTED, HOWEVER IT SHOULD WORK FINE FOR simped. Famous last words... >if (buffer = (char *) malloc(strlen(string)) == NULL) Common error: it should be strlen(string)+1. Strlen() doesn't include the trailing '\0' in its result, but you need to allocate room for it. -- Barry Margolin, Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar