+2021-05-07 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * target-descriptions.c (struct target_desc_info): Initialize
+ fields.
+ (get_tdesc_info): Use new.
+ (target_desc_info_free): Use delete.
+
2021-05-07 Simon Marchi <simon.marchi@polymtl.ca>
* target-descriptions.c (struct target_desc_info) <fetched>:
/* A flag indicating that a description has already been fetched
from the target, so it should not be queried again. */
- bool fetched;
+ bool fetched = false;
/* The description fetched from the target, or NULL if the target
did not supply any description. Only valid when
code should access this; normally, the description should be
accessed through the gdbarch object. */
- const struct target_desc *tdesc;
+ const struct target_desc *tdesc = nullptr;
/* The filename to read a target description from, as set by "set
tdesc filename ..." */
- char *filename;
+ char *filename = nullptr;
};
/* Get the inferior INF's target description info, allocating one on
get_tdesc_info (struct inferior *inf)
{
if (inf->tdesc_info == NULL)
- inf->tdesc_info = XCNEW (struct target_desc_info);
+ inf->tdesc_info = new target_desc_info;
+
return inf->tdesc_info;
}
if (tdesc_info != NULL)
{
xfree (tdesc_info->filename);
- xfree (tdesc_info);
+ delete tdesc_info;
}
}