I agree with your points below. But this is just test code - agree not much error checking going on.
It is just used against a new form I created. I am only checking against the Submitter field (ID 2) and the Assigned To field (ID 4). ARGetEntry returns zero - ie ok. Length of field values is 4 - ie 2 and 4! Made a string buffer of size 100 to copy the field values. But same error. Compiled and testing on Windows platform. (Windows XP). Would it be helpful to show the whole function - it is fairly small. Angus ----- Original Message ----- From: "Dan Hardy" <[EMAIL PROTECTED]> Newsgroups: public.remedy.arsystem.general To: <arslist@ARSLIST.ORG> Sent: Monday, July 17, 2006 11:46 PM Subject: Re: Invalid Address specified to RtlFreeHeap( 00870000, 008A1E90 ) on using FreeInternalIdList Which platform are you on? It could be caused by: 1) Different structure byte-alignment options at compile time (I've found the default setting works on Windows, on Linux you need a special -malign switch with gcc at least). I can look it up if you need it. 2) It doesn't look you are checking the return code from the API call, checking whether the returned value list has at least 2 items, that either of the values is of type AR_DATA_TYPE_CHAR, or that the pointer is not NULL. You also are copying the data using strcpy, without checking the length, rather than using strncpy or allocating a buffer of large enough size. This could cause corruption (buffer overflow) and easily explain the error, particularly if szField1 and szField2 are stack variables. 3) Different run-time library version between your code and the AR System library (you're calling malloc, it's calling free - could be mismatched) If you are on Windows, I put my money on #2 - sounds like stack corruption. I would point out that if you used the rtl library much of this would be done for you, and you wouldn't have to worry about allocating or freeing any memory, testing for null pointers, checking return codes for error conditions, etc. ;) Dan -----Original Message----- From: Action Request System discussion list(ARSList) [mailto:[EMAIL PROTECTED] On Behalf Of Angus Comber Sent: Monday, July 17, 2006 3:11 PM To: arslist@ARSLIST.ORG Subject: Invalid Address specified to RtlFreeHeap( 00870000, 008A1E90 ) on using FreeInternalIdList Hello I am doing this with ARGetEntry: ARInternalIdList idlist; idlist.numItems = 2; // need two fields idlist.internalIdList = (ARInternalId *) malloc(sizeof(ARInternalId) * idlist.numItems); idlist.internalIdList[0] = fieldID1; // eg 2 - Submitter idlist.internalIdList[1] = fieldID2; // eg 4 - Assigned To ret=ARGetEntry(&m_ARctrlstruct, szFormName, &entry.entryList[i].entryId, &idlist, &fldval, &m_StatusList); strcpy(szField1, fldval.fieldValueList[0].value.u.charVal); // copy field data strcpy(szField2, fldval.fieldValueList[1].value.u.charVal); Then I get Invalid address specified to RtlFreeHeap when I call: FreeARInternalIdList(&idlist, FALSE); What am I doing wrong? Angus ________________________________________________________________________ _______ UNSUBSCRIBE or access ARSlist Archives at http://www.wwrug.org ____________________________________________________________________________ ___ UNSUBSCRIBE or access ARSlist Archives at http://www.wwrug.org _______________________________________________________________________________ UNSUBSCRIBE or access ARSlist Archives at http://www.wwrug.org