aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli/cli-decode.h
diff options
context:
space:
mode:
authorPierre Muller <muller@sourceware.org>2012-12-05 23:23:22 +0000
committerPierre Muller <muller@sourceware.org>2012-12-05 23:23:22 +0000
commit5bc81a00b656522351c5970a4e7546e9b68870a1 (patch)
tree4b6e39064f76d1eb399f55b75c5021d249afec47 /gdb/cli/cli-decode.h
parentad288036a73ad7fa77b75522c3e06eaef70b2e57 (diff)
downloadgdb-5bc81a00b656522351c5970a4e7546e9b68870a1.zip
gdb-5bc81a00b656522351c5970a4e7546e9b68870a1.tar.gz
gdb-5bc81a00b656522351c5970a4e7546e9b68870a1.tar.bz2
Avoid memory leaks on struct cmd_list_element.doc field.
* cli/cli-decode.c (add_alias_cmd): Make a copy of doc field if flags contains DOC_ALLOCATED. (add_setshow_cmd_full): Add DOC_ALLOCATED to set and show flags. (delete_cmd): Handle DOC_ALLOCATED flag. * cli/cli-decode.h (DOC_ALLOCATED): New macro for use in flags filed of struct cmd_list_element. (struct cmd_list_element): Document new flag item.
Diffstat (limited to 'gdb/cli/cli-decode.h')
-rw-r--r--gdb/cli/cli-decode.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index edae6e8..3d4d1b6 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -51,6 +51,7 @@ cmd_types;
#define CMD_DEPRECATED 0x1
#define DEPRECATED_WARN_USER 0x2
#define MALLOCED_REPLACEMENT 0x4
+#define DOC_ALLOCATED 0x8
struct cmd_list_element
{
@@ -112,7 +113,9 @@ struct cmd_list_element
memory for replacement is malloc'ed. When a command is
undeprecated or re-deprecated at runtime we don't want to risk
calling free on statically allocated memory, so we check this
- flag. */
+ flag.
+
+ bit 3: DOC_ALLOCATED, set if the doc field should be xfree'd. */
int flags;