mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-19 22:03:57 +08:00
Fix access of an already freed memory.
* parse.c (parse_field_expression): Call xstrdup on `*name'. * completer.c (expression_completer): Free fieldname.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2008-11-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
Fix access of an already freed memory.
|
||||||
|
* parse.c (parse_field_expression): Call xstrdup on `*name'.
|
||||||
|
* completer.c (expression_completer): Free fieldname.
|
||||||
|
|
||||||
2008-11-24 Daniel Jacobowitz <dan@codesourcery.com>
|
2008-11-24 Daniel Jacobowitz <dan@codesourcery.com>
|
||||||
|
|
||||||
PR gdb/2474
|
PR gdb/2474
|
||||||
|
@ -414,9 +414,11 @@ expression_completer (char *text, char *word)
|
|||||||
|
|
||||||
add_struct_fields (type, &out, result, fieldname, flen);
|
add_struct_fields (type, &out, result, fieldname, flen);
|
||||||
result[out] = NULL;
|
result[out] = NULL;
|
||||||
|
xfree (fieldname);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
xfree (fieldname);
|
||||||
|
|
||||||
/* Commands which complete on locations want to see the entire
|
/* Commands which complete on locations want to see the entire
|
||||||
argument. */
|
argument. */
|
||||||
|
@ -1090,7 +1090,8 @@ parse_expression (char *string)
|
|||||||
/* Parse STRING as an expression. If parsing ends in the middle of a
|
/* Parse STRING as an expression. If parsing ends in the middle of a
|
||||||
field reference, return the type of the left-hand-side of the
|
field reference, return the type of the left-hand-side of the
|
||||||
reference; furthermore, if the parsing ends in the field name,
|
reference; furthermore, if the parsing ends in the field name,
|
||||||
return the field name in *NAME. In all other cases, return NULL. */
|
return the field name in *NAME. In all other cases, return NULL.
|
||||||
|
Returned non-NULL *NAME must be freed by the caller. */
|
||||||
|
|
||||||
struct type *
|
struct type *
|
||||||
parse_field_expression (char *string, char **name)
|
parse_field_expression (char *string, char **name)
|
||||||
@ -1120,6 +1121,9 @@ parse_field_expression (char *string, char **name)
|
|||||||
xfree (exp);
|
xfree (exp);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
/* (*NAME) is a part of the EXP memory block freed below. */
|
||||||
|
*name = xstrdup (*name);
|
||||||
|
|
||||||
val = evaluate_subexpression_type (exp, subexp);
|
val = evaluate_subexpression_type (exp, subexp);
|
||||||
xfree (exp);
|
xfree (exp);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user