Click here to Skip to main content
15,916,835 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: guarantee to run in a certain period Pin
Joe Woodbury26-Oct-05 0:22
professionalJoe Woodbury26-Oct-05 0:22 
QuestionDesign advice needed Pin
Keith Vitali25-Oct-05 8:03
Keith Vitali25-Oct-05 8:03 
AnswerRe: Design advice needed Pin
Achim Klein25-Oct-05 8:31
Achim Klein25-Oct-05 8:31 
AnswerRe: Design advice needed Pin
John R. Shaw25-Oct-05 9:03
John R. Shaw25-Oct-05 9:03 
GeneralRe: Design advice needed Pin
Keith Vitali26-Oct-05 9:15
Keith Vitali26-Oct-05 9:15 
AnswerRe: Design advice needed Pin
Joe Woodbury25-Oct-05 12:06
professionalJoe Woodbury25-Oct-05 12:06 
AnswerRe: Design advice needed Pin
User 58385225-Oct-05 17:21
User 58385225-Oct-05 17:21 
QuestionMalloc / Free problem Pin
Jader8925-Oct-05 6:45
Jader8925-Oct-05 6:45 
Im having a little trouble using free after a malloc.

Here is the malloc part:
GUIQueue* newMsg = (GUIQueue*)malloc( sizeof(GUIQueue) );
newMsg->data = (char*)malloc( sizeof(msg.u.reqvid) );
...
GUIQ.push( newMsg );

What i do now is pull the info from the queue (this is a MT'ed app.) and get the info and free the pointer.

GUIQueue* newMsg;
newMsg = (GUIQueue*)GUIQ.front();
GUIQ.pop(); // I know this looks weird, but pop doesnt return anything, so...
...
if( newMsg->data != NULL )
{
free(newMsg->data); // This first free causes the runtime error.
newMsg->data = NULL;
}
if( newMsg != NULL )
{
free(newMsg);
newMsg = NULL;
}

The error message that pops up is:
Unhandled exception at 0x7c901230 in LiteCycles.exe: User breakpoint.

I've cleared all my breakpoints, so i dont think it can be that, the stack looks like its deep in free and the last legiable method is _CrtIsValidHeapPointer.

Any ideas on whats causing this error? Any input is greatly appricated, thanks.
-Jader89

"There are 10 types of people, those who understand binary, and those who don't."
- Somebody, not me.
AnswerRe: Malloc / Free problem Pin
Roger Stoltz25-Oct-05 7:01
Roger Stoltz25-Oct-05 7:01 
GeneralRe: Malloc / Free problem Pin
Jader8925-Oct-05 7:31
Jader8925-Oct-05 7:31 
AnswerRe: Malloc / Free problem Pin
Maximilien25-Oct-05 7:10
Maximilien25-Oct-05 7:10 
GeneralRe: Malloc / Free problem Pin
Jader8925-Oct-05 7:33
Jader8925-Oct-05 7:33 
QuestionRe: Malloc / Free problem Pin
David Crow25-Oct-05 7:27
David Crow25-Oct-05 7:27 
AnswerRe: Malloc / Free problem Pin
Jader8925-Oct-05 7:34
Jader8925-Oct-05 7:34 
QuestionRe: Malloc / Free problem Pin
David Crow25-Oct-05 9:27
David Crow25-Oct-05 9:27 
AnswerRe: Malloc / Free problem Pin
Jader8925-Oct-05 9:34
Jader8925-Oct-05 9:34 
AnswerRe: Malloc / Free problem Pin
Jader8925-Oct-05 9:39
Jader8925-Oct-05 9:39 
GeneralRe: Malloc / Free problem Pin
David Crow25-Oct-05 9:47
David Crow25-Oct-05 9:47 
QuestionRe: Malloc / Free problem Pin
Jader8925-Oct-05 11:00
Jader8925-Oct-05 11:00 
AnswerRe: Malloc / Free problem Pin
David Crow25-Oct-05 11:07
David Crow25-Oct-05 11:07 
GeneralRe: Malloc / Free problem Pin
Jader8925-Oct-05 11:20
Jader8925-Oct-05 11:20 
GeneralRe: Malloc / Free problem Pin
Jader8925-Oct-05 11:30
Jader8925-Oct-05 11:30 
GeneralRe: Malloc / Free problem Pin
Jader8925-Oct-05 12:25
Jader8925-Oct-05 12:25 
AnswerRe: Malloc / Free problem Pin
Maximilien25-Oct-05 7:34
Maximilien25-Oct-05 7:34 
GeneralRe: Malloc / Free problem Pin
Jader8925-Oct-05 7:45
Jader8925-Oct-05 7:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.