void mallocEscapeFreeCustomAlloc2() { int *p = malloc(12); myfoo(p); free(p); myalloc2(&p); free(p); // no warning }
EXPORT_C int bar() { MY_MY amymy(0x1234); static MY_TYPE mytype(amymy); myfoo(); return mytype.get(); }
void vallocEscapeFreeUse() { int *p = valloc(12); myfoo(p); free(p); myfoo(p); // expected-warning{{Use of memory after it is freed}} }
void mallocFreeUse_params() { int *p = malloc(12); free(p); myfoo(p); //expected-warning{{Use of memory after it is freed}} }
void mallocEscapeMalloc() { int *p = malloc(12); myfoo(p); p = malloc(12); } // expected-warning{{Potential leak of memory pointed to by}}
void mallocBindFreeUse() { int *x = malloc(12); int *y = x; free(y); myfoo(x); // expected-warning{{Use of memory after it is freed}} }
void mallocEscapeFreeFree() { int *p = malloc(12); myfoo(p); free(p); free(p); // expected-warning{{Attempt to free released memory}} }
void mallocEscapeFree() { int *p = malloc(12); myfoo(p); free(p); }
void mallocEscapeFoo() { int *p = malloc(12); myfoo(p); return; // no warning }
void paramFree(int *p) { myfoo(p); free(p); // no warning myfoo(p); // expected-warning {{Use of memory after it is freed}} }
void mallocEscapeMalloc() { int *p = malloc(12); myfoo(p); p = malloc(12); } // expected-warning{{Memory is never released; potential leak}}
int foo2() { return myfoo(); }
TInt E32Main() { test.Title(); test.Start(_L("Test retrieving 0th ordinal and therefore named symbol export data")); E32EpocExpSymInfoHdr tmpHdr; E32EpocExpSymInfoHdr *readHdr; RLibrary library; // The values for the header of the dll with a 0th ordinal tmpHdr.iSize = 0x1a4; tmpHdr.iFlags = 0x0; tmpHdr.iSymCount = 0xc; tmpHdr.iSymbolTblOffset = 0x1c; tmpHdr.iStringTableSz = 0x134; tmpHdr.iStringTableOffset = 0x64; tmpHdr.iDllCount = 0x3; tmpHdr.iDepDllZeroOrdTableOffset = 0x198; test(library.Load(_L("t_oedll.dll")) == KErrNone); test.Next(_L("Attempt to retrieve named symbol data from t_oedll.dll")); readHdr = (E32EpocExpSymInfoHdr*)library.Lookup(0); test(readHdr!=NULL); test.Next(_L("Verify export data of t_oedll.dll at the 0th ordinal is that expected")); VerifyHdr(tmpHdr, *readHdr); library.Close(); test.Next(_L("Verify lookup on dll without oe export data returns NULL")); test(library.Load(_L("t_dll1.dll")) == KErrNone); readHdr = (E32EpocExpSymInfoHdr*)library.Lookup(0); test(readHdr == NULL); library.Close(); // The values for the header of the exe of the current process with a 0th ordinal tmpHdr.iSize = 0x48; tmpHdr.iFlags = 0x0; tmpHdr.iSymCount = 0x2; tmpHdr.iSymbolTblOffset = 0x1c; tmpHdr.iStringTableSz = 0x14; tmpHdr.iStringTableOffset = 0x28; tmpHdr.iDllCount = 0x3; tmpHdr.iDepDllZeroOrdTableOffset = 0x3c; test.Next(_L("Attempt to retrieve named symbol data from current process")); readHdr = (E32EpocExpSymInfoHdr*)(RProcess::ExeExportData()); test(readHdr!=NULL); test.Next(_L("Verify export data at th 0th ordinal of this exe is that expected")); //#define PRINT_ZEROTH #ifdef PRINT_ZEROTH test.Printf(_L("iSize=%08x;iFlags=%08x;iSymCount=%08x;iSymbolTblOffset=%08x\n"),readHdr->iSize,readHdr->iFlags,readHdr->iSymCount,readHdr->iSymbolTblOffset); test.Printf(_L("iStringTableSz=%08x,iStringTableOffset=%08x,iDllCount=%08x,iDepDllZeroOrdTableOffset=%08x\n"), readHdr->iStringTableSz, readHdr->iStringTableOffset,readHdr->iDllCount,readHdr->iDepDllZeroOrdTableOffset); #endif VerifyHdr(tmpHdr, *readHdr); test.Next(_L("Verify static dependency t_oedll1 has been fixed up correctly")); test(myfoo()==0x1234); // Get the 0th ordinal data from the dependency t_oedll1 and verify it readHdr=(E32EpocExpSymInfoHdr *)((TUint32)readHdr+readHdr->iDepDllZeroOrdTableOffset); TUint32 readHdrEnd = (TUint32)readHdr + 12; // This stdexe only links one stddll so the only non-NULL entry in iDepDllZeroOrdTable // should point to 0th ordinal of t_oedll1 while (*(TUint32*)readHdr == NULL && (TUint32)readHdr < readHdrEnd) { readHdr=(E32EpocExpSymInfoHdr *)(((TUint32*)readHdr)+1); } #ifdef PRINT_ZEROTH test.Printf(_L("iSize=%08x;iFlags=%08x;iSymCount=%08x;iSymbolTblOffset=%08x\n"),(*(E32EpocExpSymInfoHdr**)readHdr)->iSize,(*(E32EpocExpSymInfoHdr**)readHdr)->iFlags,(*(E32EpocExpSymInfoHdr**)readHdr)->iSymCount,(*(E32EpocExpSymInfoHdr**)readHdr)->iSymbolTblOffset); test.Printf(_L("iStringTableSz=%08x,iStringTableOffset=%08x,iDllCount=%08x,iDepDllZeroOrdTableOffset=%08x\n"), (*(E32EpocExpSymInfoHdr**)readHdr)->iStringTableSz, (*(E32EpocExpSymInfoHdr**)readHdr)->iStringTableOffset,(*(E32EpocExpSymInfoHdr**)readHdr)->iDllCount,(*(E32EpocExpSymInfoHdr**)readHdr)->iDepDllZeroOrdTableOffset); #endif tmpHdr.iSize = 0x1a4; tmpHdr.iFlags = 0x0; tmpHdr.iSymCount = 0xc; tmpHdr.iSymbolTblOffset = 0x1c; tmpHdr.iStringTableSz = 0x134; tmpHdr.iStringTableOffset = 0x64; tmpHdr.iDllCount = 0x3; tmpHdr.iDepDllZeroOrdTableOffset = 0x198; VerifyHdr(tmpHdr,**(E32EpocExpSymInfoHdr**)readHdr); test.End(); return KErrNone; }