Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!gatech!purdue!decwrl!sun!pitstop!sundc!seismo!uunet!mcvax!enea!dkuug!freja!sleipner!carllp From: carllp@sleipner.diku.dk (Carl-Lykke Pedersen) Newsgroups: comp.mail.mh Subject: Re^2: questions about slocal Message-ID: <4302@freja.diku.dk> Date: 19 Dec 88 10:39:41 GMT References: <78@adobe.COM> Sender: news@freja.diku.dk Lines: 32 edward@vangogh.sybase.com (Ed Hirgelt) writes: >I've been using slocal for several months with 6.5. I made one change to >sbr/getcpy.c to avoid dereferencing the null pointer. The code now looks >like: [src deleted] The code in mh6.6 is better: /* getcpy.c - copy a string in managed memory */ #include "../h/mh.h" #include char *getcpy (str) register char *str; { register char *cp; if (!str) { if ((cp = malloc ((unsigned) (1))) == NULL) adios (NULLCP, "unable to allocate string storage"); (void) strcpy (cp, ""); } else { if ((cp = malloc ((unsigned) (strlen (str) + 1))) == NULL) adios (NULLCP, "unable to allocate string storage"); (void) strcpy (cp, str); } return cp; }