Hi,

I have a problem which I don't really know what it is.

The POSE complained that the dynamic heap chunk with header address 
0x0001CFF8 got corrupted. The size of the chunk (%chunk_size) was larger 
than the currently accepted maximmum (%chunk_max)

I am currently using POSE 3.4

I have used the debugger but can't see where it is wrong. Here is snippet 
code below Thank you in advance.


void dbGetStudentList(dbStudentList **ptrP)
{


        dbStudentList                           *dbStudentListP;
        STUDENT                                 tempStudent;


        UInt16          totalRecords;
        UInt32          len, size, size1;
        int             index;

        Char *StudentDBName = "NPET-Student";


        totalRecords = CountRecord(StudentDBName);

        //allocate memory to the pointer worth Nth record

        size = sizeof(*dbStudentListP) +
                                                                totalRecords * 
sizeof(dbStudentListP->names[0]);

        dbStudentListP = MemPtrNew(size);

        dbStudentListP->nStudents = totalRecords;

        if(totalRecords)
          {
            size1 = sizeof(dbStudentListP->studentsRef[0]) * totalRecords;
            //////////////////////
            dbStudentListP->studentsRef =  MemPtrNew( size1 );


            for(index = 0; index < totalRecords; index++)
               {
                    tempStudent  =  * ( ReadStudRecord(StudentDBName, index ) );

                        dbStudentListP->studentsRef[index].id = 
tempStudent.studentRecordID;

                        len = StrLen(tempStudent.Name) + 1;

                    dbStudentListP->names[index] = MemPtrNew(len) ; //it complains 
here 
when there is more than 2 records

                    StrCopy(dbStudentListP->names[index], tempStudent.Name);

                   }
           }
        CloseDB();
        setDBPtr();

*ptrP = dbStudentListP;
}

Low Pui Kuen

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to