DragonFly BSD
DragonFly bugs List (threaded) for 2004-10
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: cu coredumps


To: Mark Cullen <mark.cullen@xxxxxxxxxxxxx>
From: Timour Ezeev <timour@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 27 Oct 2004 12:51:51 -0400


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@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..




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]