Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!taumet!steve From: steve@taumet.com (Stephen Clamage) Newsgroups: comp.lang.c++ Subject: Re: Is it okay to use delete after malloc? Message-ID: <574@taumet.com> Date: 30 Jan 91 18:06:26 GMT References: <1991Jan29.150219.28884@athena.mit.edu> Distribution: usa Organization: Taumetric Corporation, San Diego Lines: 11 ahodgson@athena.mit.edu (Antony Hodgson) writes: >If I create a string using one of the library routines such as strdup, >is it then acceptable to use delete, or is free() required? Using 'delete' on a pointer is not guaranteed to work if the pointer was not obtained from 'new'. If space is acquired by malloc(), you should return it with free(). -- Steve Clamage, TauMetric Corp, steve@taumet.com