Browse Source

Remove NULL checks before free().

master
Ben Kurtovic 9 years ago
parent
commit
1383d57f29
3 changed files with 7 additions and 14 deletions
  1. +1
    -2
      src/assembler/state.c
  2. +4
    -8
      src/config.c
  3. +2
    -4
      src/rom.c

+ 1
- 2
src/assembler/state.c View File

@@ -89,8 +89,7 @@ void asm_instructions_free(ASMInstruction *inst)
while (inst) {
ASMInstruction *temp = inst->next;
free(inst->bytes);
if (inst->symbol)
free(inst->symbol);
free(inst->symbol);
free(inst);
inst = temp;
}


+ 4
- 8
src/config.c View File

@@ -136,8 +136,7 @@ static char* get_rom_path_from_user()
if (paths[i] != path)
free(paths[i]);
}
if (paths)
free(paths);
free(paths);
return path;
}

@@ -351,12 +350,9 @@ int config_create(Config** config_ptr, int argc, char* argv[])
*/
void config_destroy(Config *config)
{
if (config->rom_path)
free(config->rom_path);
if (config->src_path)
free(config->src_path);
if (config->dst_path)
free(config->dst_path);
free(config->rom_path);
free(config->src_path);
free(config->dst_path);
free(config);
}



+ 2
- 4
src/rom.c View File

@@ -261,10 +261,8 @@ const char* rom_open(ROM **rom_ptr, const char *path)
*/
void rom_close(ROM *rom)
{
if (rom->name)
free(rom->name);
if (rom->data)
free(rom->data);
free(rom->name);
free(rom->data);
free(rom);
}



Loading…
Cancel
Save