Failure INSIDE malloc() ??

Pyung-Chul Kim pckim at unisql.UUCP
Sat Jun 22 00:20:12 AEST 1991


In article <677448705 at macbeth.cs.duke.edu> lsn at duke.cs.duke.edu (Lars S. Nyland) writes:
>
some stuffs deleted
>
>I would bet that you still use a pointer after you have freed
>the memory it points to.  You might amend your free statements
>to be more like:
>	free(p); p = NULL;
>just to make sure that you don't use the pointers after you have
>freed them.

Or, make sure the following should not happen:

	char	str[n];
	strcpy(str,another1); /* strlen(another1) >= n */

	char	*p;
	p = malloc(m);
	strcpy(p,another2); /* strlen(another2) >= m */

Hope this helps
-- 
Pyung-Chul Kim

UniSQL, Inc.
9390 Research Blvd., Kaleido II, Suite 220, Austin, TX 78759
Internet: execu!sequoia!unisql!pckim at cs.utexas.edu
UUCP: {uunet, cs.utexas.edu!execu}!sequoia!unisql!pckim
TEL: (512)343-7297 Ext. 332
FAX: (512)343-7383



More information about the Comp.lang.c mailing list