CHALLENGE: Find my heap corruption

CHALLENGE: Find my heap corruption

Alright, I’ve been fighting with some heap corruption for the last month or so with the Angel re-write I’ve started. The heap corruption is occurring in the client library test program, meaning the source is probably in the client library itself.

Here’s the source for the test program:

#include "AngelClient.h"

void main()
{

    AngelKV *kv = new AngelKV(L"data");
    kv->AddKV(L"Name",L"Cale Dunlap");
    kv->AddKV(L"Age",L"24");
    kv->AddKV(L"Alias",L"Mazor");

    AngelClient pClient = AngelClient("pantera","angeltest","angeltest");
    AngelResponse *pResponse = pClient.RunCommand( L"AddUser", kv );

    if( pResponse != NULL )
        delete pResponse;

    pClient.Disconnect();
}

The heap corruption is occurring in the default destructor of the AngelClient class. Here is the full source to the Angel Solution. The visual studio project/solution is for Visual Studio 2008. There’s a server and client written in C#, but right now I’m focusing on the client written in C++. I’m tempted to pay a reward to the person who finds it. If you happen to come across this post and find where my heap corruption is coming from, drop me a line at [email protected]

The error messages:

Things I’ve tried so far:

  • Replaced the socket library 3 times thinking it was something within the socket library
  • Rewrote the client class twice
  • Used STL for the linked lists and strings to remove any errors I may have put in doing the linked listing and string handling myself
  • Undid the STL stuff for the string handling because that obviously didn’t fix it, plus I was getting even more weirdness with using STL anyway, so it was a step in the wrong direction to begin with. There’s still a little bit of STL string stuff in there, but only for splitting key/value pairs.

I’m at wits end with this, and I need some help. Thank you.




Comments are closed.