troubleshooting Question

Debug Error in Visual C++ program -- "Damage after Normal block (#56) at 0x00304700"

Avatar of Pegasus40218
Pegasus40218 asked on
2 Comments1 Solution1786 ViewsLast Modified:
I recently inherited a "supposedly" running program that I have to provide support and enhancments for.  When I attempt to run the code in the Visual C++ 6 IDE, it seems to run fine until the destructor of one of the classes is called.  Then I get the following Debug Error:  "DAMAGE:  after Normal block (#56) at 0x00304700.

I've traced the problem down to a "delete" statement, but I haven't been able to determine exactly what's wrong with it.

Here's the relevant code:

// Header file (.h)
class MailRoomStarter : public NTService
      bool m_running;

      // Stop the use of default and copy constructors

      char            *m_MailRoomProgramPath;


// CPP file (.CPP)
MailRoomStarter::MailRoomStarter(const char* srvname,
                                             LPSERVICE_MAIN_FUNCTION      fpSrvMain,
                                             LPHANDLER_FUNCTION            fpSrvCtrl
                                             ) : NTService(srvname, fpSrvMain, fpSrvCtrl)
      char path[MAX_PATH];


      GetRegistryString(HKEY_LOCAL_MACHINE, "\\SOFTWARE\\xxx\\yyy\\Common\\ExePath", path);
      m_MailRoomProgramPath = new char[strlen(path)];

      if(m_MailRoomProgramPath != NULL)
                          // this is where the error occurs
            delete m_MailRoomProgramPath;


I've tried altering the delete line to the following:

delete [] m_MailRoomProgramPath;

...but, I still get the same error.

If anyone has any suggestions, I'd appreciate it.

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros