typy_getitem (PyObject *self, PyObject *key)
{
struct type *type = ((type_object *) self)->type;
- char *field;
int i;
- field = python_string_to_host_string (key);
+ gdb::unique_xmalloc_ptr<char> field = python_string_to_host_string (key);
if (field == NULL)
return NULL;
{
const char *t_field_name = TYPE_FIELD_NAME (type, i);
- if (t_field_name && (strcmp_iw (t_field_name, field) == 0))
+ if (t_field_name && (strcmp_iw (t_field_name, field.get ()) == 0))
{
return convert_field (type, i);
}