From c8c122932061ba5c68cc6893262990463162de1c Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Tue, 3 Jul 2007 01:23:01 +0000 Subject: [PATCH] * target-descriptions.c (tdesc_create_reg): Do not set reg->type to NULL. * cli/cli-script.c (build_command_line): Update NULL check. --- gdb/ChangeLog | 7 +++++++ gdb/cli/cli-script.c | 4 ++-- gdb/target-descriptions.c | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 30a1652a71..d75da08ea0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2007-07-02 Daniel Jacobowitz + + * target-descriptions.c (tdesc_create_reg): Do not set reg->type + to NULL. + + * cli/cli-script.c (build_command_line): Update NULL check. + 2007-07-02 Michael Snyder * p-exp.y (yylex): Memory leak, 'uptokstart' must be freed (Coverity). diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index 2dff85e69d..5916008186 100644 --- a/gdb/cli/cli-script.c +++ b/gdb/cli/cli-script.c @@ -85,6 +85,7 @@ build_command_line (enum command_control_type type, char *args) if (args == NULL && (type == if_control || type == while_control)) error (_("if/while commands require arguments.")); + gdb_assert (args != NULL); cmd = (struct command_line *) xmalloc (sizeof (struct command_line)); cmd->next = NULL; @@ -95,8 +96,7 @@ build_command_line (enum command_control_type type, char *args) = (struct command_line **) xmalloc (sizeof (struct command_line *) * cmd->body_count); memset (cmd->body_list, 0, sizeof (struct command_line *) * cmd->body_count); - if (args != NULL) - cmd->line = savestring (args, strlen (args)); + cmd->line = savestring (args, strlen (args)); return cmd; } diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index 6df4547e8b..f15340d9e3 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -792,7 +792,7 @@ tdesc_create_reg (struct tdesc_feature *feature, const char *name, reg->save_restore = save_restore; reg->group = group ? xstrdup (group) : NULL; reg->bitsize = bitsize; - reg->type = type ? xstrdup (type) : NULL; + reg->type = type ? xstrdup (type) : xstrdup (""); /* If the register's type is target-defined, look it up now. We may not have easy access to the containing feature when we want it later. */ -- 2.34.1