* deffilep.y: Replace "if (x) free (x)" with "free (x)" thoughout.
* emultempl/elf.em: Likewise.
* emultempl/msp430.em: Likewise.
* emultempl/pe.em: Likewise.
* emultempl/pep.em: Likewise.
* emultempl/ppc64elf.em: Likewise.
* emultempl/xtensaelf.em: Likewise.
* ldelf.c: Likewise.
* ldfile.c: Likewise.
* ldmain.c: Likewise.
* ldmisc.c: Likewise.
* lexsup.c: Likewise.
* pe-dll.c: Likewise.
+2020-05-21 Alan Modra <amodra@gmail.com>
+
+ * deffilep.y: Replace "if (x) free (x)" with "free (x)" thoughout.
+ * emultempl/elf.em: Likewise.
+ * emultempl/msp430.em: Likewise.
+ * emultempl/pe.em: Likewise.
+ * emultempl/pep.em: Likewise.
+ * emultempl/ppc64elf.em: Likewise.
+ * emultempl/xtensaelf.em: Likewise.
+ * ldelf.c: Likewise.
+ * ldfile.c: Likewise.
+ * ldmain.c: Likewise.
+ * ldmisc.c: Likewise.
+ * lexsup.c: Likewise.
+ * pe-dll.c: Likewise.
+
2020-05-20 Nelson Chu <nelson.chu@sifive.com>
* testsuite/ld-riscv-elf/attr-merge-arch-01.d: Updated
if (!fdef)
return;
- if (fdef->name)
- free (fdef->name);
- if (fdef->description)
- free (fdef->description);
+ free (fdef->name);
+ free (fdef->description);
if (fdef->section_defs)
{
for (i = 0; i < fdef->num_section_defs; i++)
{
- if (fdef->section_defs[i].name)
- free (fdef->section_defs[i].name);
- if (fdef->section_defs[i].class)
- free (fdef->section_defs[i].class);
+ free (fdef->section_defs[i].name);
+ free (fdef->section_defs[i].class);
}
free (fdef->section_defs);
}
{
for (i = 0; i < fdef->num_exports; i++)
{
- if (fdef->exports[i].internal_name
- && fdef->exports[i].internal_name != fdef->exports[i].name)
+ if (fdef->exports[i].internal_name != fdef->exports[i].name)
free (fdef->exports[i].internal_name);
- if (fdef->exports[i].name)
- free (fdef->exports[i].name);
- if (fdef->exports[i].its_name)
- free (fdef->exports[i].its_name);
+ free (fdef->exports[i].name);
+ free (fdef->exports[i].its_name);
}
free (fdef->exports);
}
{
for (i = 0; i < fdef->num_imports; i++)
{
- if (fdef->imports[i].internal_name
- && fdef->imports[i].internal_name != fdef->imports[i].name)
+ if (fdef->imports[i].internal_name != fdef->imports[i].name)
free (fdef->imports[i].internal_name);
- if (fdef->imports[i].name)
- free (fdef->imports[i].name);
- if (fdef->imports[i].its_name)
- free (fdef->imports[i].its_name);
+ free (fdef->imports[i].name);
+ free (fdef->imports[i].its_name);
}
free (fdef->imports);
}
einfo ("%s:%d: Warning: path components stripped from %s, '%s'\n",
def_filename, linenumber, is_dll ? "LIBRARY" : "NAME",
name);
- if (def->name)
- free (def->name);
+ free (def->name);
/* Append the default suffix, if none specified. */
if (strchr (image_name, '.') == 0)
{
return FALSE;
case OPTION_BUILD_ID:
- if (ldelf_emit_note_gnu_build_id != NULL)
- {
- free ((char *) ldelf_emit_note_gnu_build_id);
- ldelf_emit_note_gnu_build_id = NULL;
- }
+ free ((char *) ldelf_emit_note_gnu_build_id);
+ ldelf_emit_note_gnu_build_id = NULL;
if (optarg == NULL)
optarg = DEFAULT_BUILD_ID_STYLE;
if (strcmp (optarg, "none"))
end:
free (upper_name);
free (lower_name);
- if (buf)
- free (buf);
+ free (buf);
return lower;
}
EOF
pe_dll_characteristics |= IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE;
break;
case OPTION_BUILD_ID:
- if (emit_build_id != NULL)
- {
- free ((char *) emit_build_id);
- emit_build_id = NULL;
- }
+ free ((char *) emit_build_id);
+ emit_build_id = NULL;
if (optarg == NULL)
optarg = DEFAULT_BUILD_ID_STYLE;
if (strcmp (optarg, "none"))
pe_dll_characteristics |= IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE;
break;
case OPTION_BUILD_ID:
- if (emit_build_id != NULL)
- {
- free ((char *) emit_build_id);
- emit_build_id = NULL;
- }
+ free ((char *) emit_build_id);
+ emit_build_id = NULL;
if (optarg == NULL)
optarg = DEFAULT_BUILD_ID_STYLE;
if (strcmp (optarg, "none"))
fprintf (stderr, "%s: %s\n", program_name, line);
}
fflush (stderr);
- if (msg != NULL)
- free (msg);
+ free (msg);
finish_default ();
}
remove_section (abfd, insn_sec);
- if (insn_contents)
- free (insn_contents);
+ free (insn_contents);
return TRUE;
cleanup:
if (prop_sec && prop_sec->owner)
remove_section (abfd, prop_sec);
- if (insn_contents)
- free (insn_contents);
- if (internal_relocs)
- free (internal_relocs);
+ free (insn_contents);
+ free (internal_relocs);
return FALSE;
}
insn_sec_name, abfd, message);
}
}
- if (owned_prop_sec_name)
- free (owned_prop_sec_name);
+ free (owned_prop_sec_name);
}
{
new_sections[i] = deps->sections[i];
}
- if (deps->sections != NULL)
- free (deps->sections);
+ free (deps->sections);
deps->sections = new_sections;
deps->size = new_size;
}
}
xtensa_set_section_deps (deps, sec, NULL);
}
- if (deps->sections)
- free (deps->sections);
-
+ free (deps->sections);
free (deps);
}
ldelf_parse_ld_so_conf (info, pattern);
#endif
- if (newp)
- free (newp);
+ free (newp);
}
static bfd_boolean
skip = 1;
}
free (arg1);
- if (arg2) free (arg2);
- if (arg3) free (arg3);
+ free (arg2);
+ free (arg3);
break;
case NAME:
case LNAME:
free (yylval.name);
break;
case INT:
- if (yylval.bigint.str)
- free (yylval.bigint.str);
+ free (yylval.bigint.str);
break;
}
token = yylex ();
else
{
error_count = 0;
- if (error_name != NULL)
- free (error_name);
+ free (error_name);
error_name = xstrdup (name);
}
abfd, functionname);
last_bfd = abfd;
- if (last_file != NULL)
- free (last_file);
+ free (last_file);
last_file = NULL;
if (filename)
last_file = xstrdup (filename);
- if (last_function != NULL)
- free (last_function);
+ free (last_function);
last_function = xstrdup (functionname);
}
discard_last = FALSE;
if (discard_last)
{
last_bfd = NULL;
- if (last_file != NULL)
- {
- free (last_file);
- last_file = NULL;
- }
- if (last_function != NULL)
- {
- free (last_function);
- last_function = NULL;
- }
+ free (last_file);
+ last_file = NULL;
+ free (last_function);
+ last_function = NULL;
}
}
break;
case 'Y':
if (CONST_STRNEQ (optarg, "P,"))
optarg += 2;
- if (default_dirlist != NULL)
- free (default_dirlist);
+ free (default_dirlist);
default_dirlist = xstrdup (optarg);
break;
case 'y':
e[j - 1].flag_constant |= e[i].flag_constant;
e[j - 1].flag_noname |= e[i].flag_noname;
e[j - 1].flag_data |= e[i].flag_data;
- if (e[i].name)
- free (e[i].name);
- if (e[i].internal_name)
- free (e[i].internal_name);
- if (e[i].its_name)
- free (e[i].its_name);
+ free (e[i].name);
+ free (e[i].internal_name);
+ free (e[i].its_name);
}
else
{