cu coredumps

Timour Ezeev timour at pivotaldynamics.com
Wed Oct 27 09:51:51 PDT 2004


	You got the first case AFAIK, but for the second case you are loosing cp
	when you assign it to tmp_cp. The possible solutions are:
	1. Create new temp holder (in else) for cp and free() it after
	   assignment
		or
	2. If you dont want to create a new pointer, swap pointers in plase,
	   like this
	(int)tmp_cp ^= (int)cp; (int)cp ^= (int)tmp_cp; (int)tmp_cp ^= (int)cp;
	free(tmp_cp);
	or something similar :)

	Regards,

--
Timour Ezeev
Pivotal Dynamics
timour at xxxxxxxxxxxxxxxxxxx
V: 305.406.9904
F: 305.406.9689
On Wed, 27 Oct 2004, Mark Cullen wrote:

Timour Ezeev wrote:
 	I think you got small memory leak there IMHO (either tmp_cp is not 
used
 	but allocated or cp is lost).


I think I see what you mean with the tmp_cp allocated but not used. I don't 
think I get you on the cp is lost part though. Is the attached better?

Also, where would I put the free() exactly? I forgot about that..






More information about the Bugs mailing list