comparison romdb.c @ 1593:24508cb54f87

Fix a number of other memory errors (mostly leaks again) identified by valgrind
author Michael Pavone <pavone@retrodev.com>
date Thu, 28 Jun 2018 09:27:05 -0700
parents 31effaadf877
children c206a422d466
comparison
equal deleted inserted replaced
1592:31effaadf877 1593:24508cb54f87
606 matching_chunks++; 606 matching_chunks++;
607 } 607 }
608 } 608 }
609 if (matching_chunks == 0) { 609 if (matching_chunks == 0) {
610 //Nothing mapped in the relevant range for the lock-on cart, ignore this mapping 610 //Nothing mapped in the relevant range for the lock-on cart, ignore this mapping
611 free_rom_info(&lock_info);
611 return; 612 return;
612 } else if (matching_chunks > 1) { 613 } else if (matching_chunks > 1) {
613 state->info->map_chunks += matching_chunks - 1; 614 state->info->map_chunks += matching_chunks - 1;
614 state->info->map = realloc(state->info->map, sizeof(memmap_chunk) * state->info->map_chunks); 615 state->info->map = realloc(state->info->map, sizeof(memmap_chunk) * state->info->map_chunks);
615 memset(state->info->map + state->info->map_chunks - (matching_chunks - 1), 0, sizeof(memmap_chunk) * (matching_chunks - 1)); 616 memset(state->info->map + state->info->map_chunks - (matching_chunks - 1), 0, sizeof(memmap_chunk) * (matching_chunks - 1));