看板 DFBSD_bugs 關於我們 聯絡資訊
I don't have the code before me right now and made my comments based on the diff you proveded. You sure can free() cp before assigning it to tmp_cp. That should work too. Unless it points to a static memory block or memory on the stock. As I said, I don't have a source code here. But should be able to determine if it is safe to free() cp considering the above. Regards, -- Timour Ezeev Pivotal Dynamics timour@pivotaldynamics.com V: 305.406.9904 F: 305.406.9689 On Wed, 27 Oct 2004, Mark Cullen wrote: > 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.. > > Actually, would I free(cp) just before reassigning cp to tmp_cp? Then > assuming cp got free'd later on in the code would that then be free'ing > tmp_cp? I'm guessing it wouldn't work quite like that, would it? > >