|
From: | Erik Slagter |
Subject: | Re: RESOLVED [libmicrohttpd] Memory leak? |
Date: | Wed, 10 Nov 2010 19:39:13 +0100 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.4 ThunderBrowse/3.3.2 |
Based on your code, I can clearly see that the callback is called, but obviously with the wrong address. However, the MHD code internally clearly uses the right address, so the best explanation for the difference would be some kind of memory corruption going on in between. Have you tried valgrind on your code? Again, if you can produce a stand-alone *compiling* example where the issue still arises, I'll be happy to take another look, but so far this seems to be most likely a bug in the rest of your C++ code. The way you use the API (from what I can see) seems to be fine.
When I was stripping the code to bare basics, I found out that the parameter sequence for my callback function was wrong, the struct MHD_Connection * and the void ** con_cls where reversed, so that also explains why I got a pointer so close to the actual correct pointer. From a quick glance at the output, it seems that all runs okay now and the memory is released at last. I'll have to run it (again) through valgrind yet.
I guess that's the disadvantage of passing function pointers using a mechanism that doesn't support prototypes.
smime.p7s
Description: S/MIME Cryptographic Signature
[Prev in Thread] | Current Thread | [Next in Thread] |