Ticket #9096: cruise_memory_leaks.patch
File cruise_memory_leaks.patch, 6.3 KB (added by , 15 years ago) |
---|
-
engines/cruise/background.cpp
94 94 debug(1, "Loading BG: %s", name); 95 95 96 96 if (!backgroundScreens[idx]) { 97 free(backgroundScreens[idx]); 97 98 backgroundScreens[idx] = (uint8 *)mallocAndZero(320 * 200); 98 99 } 99 100 … … 112 113 return (-18); 113 114 } 114 115 116 117 115 118 if (lastFileSize == 32078 || lastFileSize == 32080 || lastFileSize == 32034) { 116 119 colorMode = 0; 117 120 } else { … … 208 211 loadCVT(&ptr2); 209 212 } 210 213 214 free(ptrToFree); 211 215 212 216 if (name != backgroundTable[idx].name) 213 217 strcpy(backgroundTable[idx].name, name); -
engines/cruise/cell.cpp
221 221 // TODO: complelty wrong 222 222 //freeMessageList(si); 223 223 224 if (si->gfxPtr) { 225 free(si->gfxPtr); 226 } 227 224 228 free(si); 225 229 226 230 currentObj = dx; -
engines/cruise/cruise_main.cpp
351 351 if (entryNumber >= NUM_FILE_ENTRIES) 352 352 return; 353 353 354 if (!filesDatabase[entryNumber].subData.ptr)355 return;354 // if (!filesDatabase[entryNumber].subData.ptr) 355 // return; 356 356 357 357 free(filesDatabase[entryNumber].subData.ptr); 358 free(filesDatabase[entryNumber].subData.ptrMask); 358 359 359 360 filesDatabase[entryNumber].subData.ptr = NULL; 360 361 filesDatabase[entryNumber].subData.ptrMask = NULL; … … 531 532 oldPtr->nextScriptPtr = ptr->nextScriptPtr; 532 533 533 534 if (ptr->var6 && ptr->varA) { 534 //free(ptr->var6);535 free(ptr->var6); 535 536 } 536 537 537 538 free(ptr); -
engines/cruise/dataLoader.cpp
192 192 width = (width * 8) / 5; 193 193 } 194 194 195 if (filesDatabase[entryNumber].subData.ptr) { 196 free(filesDatabase[entryNumber].subData.ptr); 197 } 198 195 199 filesDatabase[entryNumber].subData.ptr = (uint8 *) mallocAndZero(size + div); 196 200 197 201 if (!filesDatabase[entryNumber].subData.ptr) { … … 455 459 456 460 if (currentDestEntry == -1) { 457 461 fileIndex = createResFileEntry(localBuffer.width, localBuffer.height, resourceSize, localBuffer.type); 458 } else { 462 } else { 459 463 fileIndex = updateResFileEntry(localBuffer.height, localBuffer.width, resourceSize, currentDestEntry, localBuffer.type); 460 464 } 461 465 -
engines/cruise/function.cpp
275 275 while (pCurrent) { 276 276 cellStruct *pNext = pCurrent->next; 277 277 278 if (pCurrent->freeze == 0) {278 //if (pCurrent->freeze == 0) { 279 279 free(pCurrent->gfxPtr); 280 280 free(pCurrent); 281 }281 //} 282 282 283 283 var_2 = 1; 284 284 -
engines/cruise/overlay.cpp
175 175 (exportEntryStruct *) mallocAndZero(ovlData->numSymbGlob * sizeof(exportEntryStruct)); 176 176 177 177 if (!ovlData->arraySymbGlob) { 178 free(unpackedBuffer); 178 179 return (-2); 179 180 } 180 181 … … 191 192 ovlData->arrayNameSymbGlob = (char *) mallocAndZero(ovlData->exportNamesSize); 192 193 193 194 if (!ovlData->arrayNameSymbGlob) { 195 free(unpackedBuffer); 194 196 return (-2); 195 197 } 196 198 … … 205 207 sizeof(importDataStruct)); 206 208 207 209 if (!ovlData->arrayRelocGlob) { 210 free(unpackedBuffer); 208 211 return (-2); 209 212 } 210 213 … … 221 224 ovlData->arrayNameRelocGlob = (char *) mallocAndZero(ovlData->nameExportSize); 222 225 223 226 if (!ovlData->arrayNameRelocGlob) { 227 free(unpackedBuffer); 224 228 return (-2); 225 229 } 226 230 … … 234 238 ovlData->arrayMsgRelHeader = (linkDataStruct *) mallocAndZero(ovlData->numMsgRelHeader * sizeof(linkDataStruct)); 235 239 236 240 if (!ovlData->arrayMsgRelHeader) { 241 free(unpackedBuffer); 237 242 return (-2); 238 243 } 239 244 … … 271 276 (ovlData3Struct *) mallocAndZero(ovlData->numProc * sizeof(ovlData3Struct)); 272 277 273 278 if (!ovlData->arrayProc) { 279 free(unpackedBuffer); 274 280 return (-2); 275 281 } 276 282 … … 297 303 tempPtr->dataPtr = (uint8 *) mallocAndZero(tempPtr->sizeOfData); 298 304 299 305 if (!tempPtr->dataPtr) { 306 free(unpackedBuffer); 300 307 return (-2); 301 308 } 302 309 … … 324 331 (ovlData3Struct *) mallocAndZero(ovlData->numRel * sizeof(ovlData3Struct)); 325 332 326 333 if (!ovlData->ptr1) { 334 free(unpackedBuffer); 327 335 return (-2); 328 336 } 329 337 … … 350 358 tempPtr->dataPtr = (uint8 *) mallocAndZero(tempPtr->sizeOfData); 351 359 352 360 if (!tempPtr->dataPtr) { 361 free(unpackedBuffer); 353 362 return (-2); 354 363 } 355 364 … … 379 388 freePtr(unpackedBuffer); 380 389 } */ 381 390 391 392 free(unpackedBuffer); 382 393 return (-2); 383 394 } 384 395 … … 392 403 sizeof(objDataStruct)); 393 404 394 405 if (!ovlData->arrayObject) { 406 free(unpackedBuffer); 395 407 return (-2); 396 408 } 397 409 … … 419 431 sizeof(objectParams)); 420 432 421 433 if (!ovlData->arrayObjVar) { 434 free(unpackedBuffer); 422 435 return (-2); 423 436 } 424 437 } … … 430 443 sizeof(objectParams)); 431 444 432 445 if (!ovlData->arrayStates) { 446 free(unpackedBuffer); 433 447 return (-2); 434 448 } 435 449 … … 460 474 (uint8 *) mallocAndZero(ovlData->sizeOfData4); 461 475 462 476 if (!ovlData->data4Ptr) { 477 free(unpackedBuffer); 463 478 return (-2); 464 479 } 465 480 } 466 481 482 free(unpackedBuffer); 483 467 484 if (ovlData-> 468 485 specialString1Length /*|| ovlData->specialString2Length */ 469 486 || ovlData->stringTable) { … … 523 540 * freePtr(unpackedBuffer); 524 541 * } */ 525 542 543 free(unpackedBuffer); 544 526 545 return (-2); 527 546 } 528 547 … … 541 560 * freePtr(unpackedBuffer); 542 561 * } */ 543 562 563 free(unpackedBuffer); 544 564 return (-2); 545 565 } 546 566 … … 562 582 * { 563 583 * freePtr(unpackedBuffer); 564 584 * } */ 565 585 free(unpackedBuffer); 566 586 return (-2); 567 587 } 568 588 569 589 s2.read(ovlData->stringTable[i].string, ovlData->stringTable[i].length); 570 590 } 571 591 } 592 593 free(unpackedBuffer); 572 594 } 573 595 #ifdef DUMP_SCRIPT 574 596 {