aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli/cli-script.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/cli/cli-script.c')
-rw-r--r--gdb/cli/cli-script.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 1147073..fbcc2dd 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -1611,24 +1611,27 @@ document_command (char *comname, int from_tty)
doclines = read_command_lines (tmpbuf, from_tty, 0, 0, 0);
if (c->doc)
- xfree (c->doc);
+ xfree ((char *) c->doc);
{
struct command_line *cl1;
int len = 0;
+ char *doc;
for (cl1 = doclines; cl1; cl1 = cl1->next)
len += strlen (cl1->line) + 1;
- c->doc = (char *) xmalloc (len + 1);
- *c->doc = 0;
+ doc = (char *) xmalloc (len + 1);
+ *doc = 0;
for (cl1 = doclines; cl1; cl1 = cl1->next)
{
- strcat (c->doc, cl1->line);
+ strcat (doc, cl1->line);
if (cl1->next)
- strcat (c->doc, "\n");
+ strcat (doc, "\n");
}
+
+ c->doc = doc;
}
free_command_lines (&doclines);