As krmed already stated, make sure your allocation routine isn't being called multiple times. However, I wouldn't make krmed's change, since that might just be fixing the symptoms and not the real issue. It is the memory allocation version of the "off by one" error where someone fixes the problem by just adding one without tracking down the reason why the value is off by one. Another problem might be that your closedown code isn't being invoked. I often see people spend endless amounts of time trying to figure out why are routine isn't working when in fact, the routine isn't even being invoked. Both of those problems are the same class of problem, improper execution path. Of course, this is all assuming that it is CallSumBin that is leaking. If you haven't verified that, then you might be looking at the wrong issue. As to what Christian said, he is right. Constructing the filename like that is akin to running with scissors. As long as you are careful, things are "ok". But a slight mistake can cause memory corruption (which can manifest itself as a leak in some instances) and security issues. I won't go so far as saying C style is crap, mainly because I have seen far too many string processing systems created with managed strings that are just dogs. But you are playing with fire and really need to understand what you are doing when you do work with C strings. Tim Smith I'm going to patent thought. I have yet to see any prior art. -- modified at 9:56 Thursday 3rd November, 2005