Click here to Skip to main content
15,896,154 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to extract "rich text" from a windows control? Pin
Waldermort7-Sep-06 8:50
Waldermort7-Sep-06 8:50 
GeneralRe: How to extract "rich text" from a windows control? Pin
ed welch7-Sep-06 8:52
ed welch7-Sep-06 8:52 
GeneralRe: How to extract "rich text" from a windows control? Pin
ed welch7-Sep-06 10:24
ed welch7-Sep-06 10:24 
GeneralRe: How to extract "rich text" from a windows control? Pin
Naveen7-Sep-06 21:46
Naveen7-Sep-06 21:46 
AnswerRe: How to extract "rich text" from a windows control? Pin
ed welch7-Sep-06 13:55
ed welch7-Sep-06 13:55 
QuestionC++ Refactory Pin
knoxpointer7-Sep-06 8:04
knoxpointer7-Sep-06 8:04 
AnswerRe: C++ Refactory Pin
DaTxomin7-Sep-06 9:06
DaTxomin7-Sep-06 9:06 
QuestionProblems with realloc - heap corruption Pin
nadiric7-Sep-06 6:52
nadiric7-Sep-06 6:52 
I'm using a parent class that holds pointers to child classes (parent-child is the application's terminology, not indicating heirarchy in c++).

The parent class has an array of pointers to children named "children"

To save space (and I need all I can get), I want to dynamically allocate this array. I have been using malloc/realloc with success in the past, but recently it's been reporting heap corruption:

"Heap block at 01720DD8 modified at 01720DE4 past requested size of 4"

before stopping at this line in memcpy_s.c:

"memcpy(dst, src, count);"

The realloc command in the code that is initiating the problem is indicated below. This array is initially malloc'd in the constructor of the class with a size of one child pointer.

bool parent::addchild(child *childToAdd){
//////////////////////////////
// Add child to children
//////////////////////////////
numchildren++;
children = (child**)realloc(children,(numchildren * sizeof(child*))); //<--Error occurs here
children[(numchildren-1)] = childToAdd;
return TRUE;
}

Thanks for any help
AnswerRe: Problems with realloc - heap corruption Pin
nadiric7-Sep-06 7:03
nadiric7-Sep-06 7:03 
GeneralRe: Problems with realloc - heap corruption Pin
Waldermort7-Sep-06 7:20
Waldermort7-Sep-06 7:20 
GeneralRe: Problems with realloc - heap corruption Pin
nadiric7-Sep-06 7:24
nadiric7-Sep-06 7:24 
GeneralRe: Problems with realloc - heap corruption Pin
Waldermort7-Sep-06 7:28
Waldermort7-Sep-06 7:28 
AnswerRe: Problems with realloc - heap corruption Pin
Jun Du7-Sep-06 7:15
Jun Du7-Sep-06 7:15 
GeneralRe: Problems with realloc - heap corruption Pin
nadiric7-Sep-06 7:22
nadiric7-Sep-06 7:22 
GeneralRe: Problems with realloc - heap corruption Pin
Jun Du7-Sep-06 7:43
Jun Du7-Sep-06 7:43 
GeneralRe: Problems with realloc - heap corruption Pin
Zac Howland7-Sep-06 8:39
Zac Howland7-Sep-06 8:39 
AnswerRe: Problems with realloc - heap corruption Pin
Stephen Hewitt8-Sep-06 2:03
Stephen Hewitt8-Sep-06 2:03 
QuestionAnother impossible question Pin
Waldermort7-Sep-06 6:50
Waldermort7-Sep-06 6:50 
AnswerRe: Another impossible question Pin
JWood7-Sep-06 7:09
JWood7-Sep-06 7:09 
GeneralRe: Another impossible question Pin
Waldermort7-Sep-06 7:15
Waldermort7-Sep-06 7:15 
GeneralRe: Another impossible question [modified] Pin
Anonymuos7-Sep-06 11:38
Anonymuos7-Sep-06 11:38 
AnswerRe: Another impossible question Pin
Jun Du7-Sep-06 7:36
Jun Du7-Sep-06 7:36 
QuestionRe: Another impossible question Pin
Zac Howland7-Sep-06 8:50
Zac Howland7-Sep-06 8:50 
AnswerRe: Another impossible question Pin
Waldermort7-Sep-06 18:41
Waldermort7-Sep-06 18:41 
Questionpreprocessor directive Pin
Lord_Vader7-Sep-06 6:49
Lord_Vader7-Sep-06 6:49 

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.