@@ -1481,6 +1481,7 @@ static int writeMem(struct Dynamic_Loader_Initialize *this, void *buf,
{
struct DBLLInit *pInit = (struct DBLLInit *)this;
struct DBLL_LibraryObj *lib;
+ struct DBLL_TarObj *pTarget;
struct DBLL_SectInfo sectInfo;
u32 memType;
bool retVal = true;
@@ -1491,20 +1492,24 @@ static int writeMem(struct Dynamic_Loader_Initialize *this, void *buf,
memType = (DLOAD_SECTION_TYPE(info->type) == DLOAD_TEXT) ? DBLL_CODE :
DBLL_DATA;
- if (lib != NULL) {
- retVal = (*lib->pTarget->attrs.write)(lib->pTarget->
- attrs.wHandle, addr, buf, nBytes, memType);
- }
- if (lib->pTarget->attrs.logWrite) {
- sectInfo.name = info->name;
- sectInfo.runAddr = info->run_addr;
- sectInfo.loadAddr = info->load_addr;
- sectInfo.size = info->size;
- sectInfo.type = memType;
- /* Pass the information about what we've written to
- * another module */
- (*lib->pTarget->attrs.logWrite)(lib->pTarget->
- attrs.logWriteHandle, §Info, addr, nBytes);
+ if ((lib != NULL) &&
+ ((pTarget = lib->pTarget) != NULL) &&
+ (pTarget->attrs.write != NULL)) {
+ retVal = (*pTarget->attrs.write)(pTarget->attrs.wHandle,
+ addr, buf, nBytes, memType);
+
+ if (pTarget->attrs.logWrite) {
+ sectInfo.name = info->name;
+ sectInfo.runAddr = info->run_addr;
+ sectInfo.loadAddr = info->load_addr;
+ sectInfo.size = info->size;
+ sectInfo.type = memType;
+ /* Pass the information about what we've written to
+ * another module */
+ (*pTarget->attrs.logWrite)(
+ pTarget->attrs.logWriteHandle,
+ §Info, addr, nBytes);
+ }
}
return retVal;
}