diff options
author | Dario Lombardo <lomato@gmail.com> | 2016-02-07 13:04:18 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2016-02-08 06:04:13 +0000 |
commit | 9f28bce07d0502bd51963c8e777be6f588cc919d (patch) | |
tree | 914ef674badc253d480be9abac1ddf546e41ac72 /epan/prefs-int.h | |
parent | 40331511ed9c117703c3097f23e3a2f17b17e993 (diff) |
prefs: fix a leak.
This change fix a leak in the prefs subsystem when setting a preference as obsolete.
Found by valgrind.
==5779== 1 bytes in 1 blocks are definitely lost in loss record 7 of 3,421
==5779== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==5779== by 0xA7FE610: g_malloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0)
==5779== by 0xA815B0E: g_strdup (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0)
==5779== by 0x65E01DF: register_string_like_preference (prefs.c:1052)
==5779== by 0x65E054E: prefs_register_string_preference (prefs.c:1096)
==5779== by 0x688D010: proto_register_dtls (packet-dtls.c:1828)
==5779== by 0x71C4C34: register_all_protocols (register.c:350)
==5779== by 0x65EEFA7: proto_init (proto.c:521)
==5779== by 0x65CD621: epan_init (epan.c:126)
==5779== by 0x115330: main (tshark.c:1220)
Bug: 12096
Change-Id: I8f36114e2098b0255b4e774c6e0f35b64da6d366
Reviewed-on: https://code.wireshark.org/review/13798
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/prefs-int.h')
-rw-r--r-- | epan/prefs-int.h | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/epan/prefs-int.h b/epan/prefs-int.h index cab10d0bd1..f6d3160e1b 100644 --- a/epan/prefs-int.h +++ b/epan/prefs-int.h @@ -91,20 +91,18 @@ struct pref_custom_cbs { * PREF_OBSOLETE is used for preferences that a module used to support * but no longer supports; we give different error messages for them. */ -typedef enum { - PREF_UINT, - PREF_BOOL, - PREF_ENUM, - PREF_STRING, - PREF_RANGE, - PREF_STATIC_TEXT, - PREF_UAT, - PREF_FILENAME, - PREF_COLOR, /* XXX - These are only supported for "internal" (non-protocol) */ - PREF_CUSTOM, /* use and not as a generic protocol preference */ - PREF_OBSOLETE, - PREF_DIRNAME -} pref_type_t; +#define PREF_UINT (1u << 0) +#define PREF_BOOL (1u << 1) +#define PREF_ENUM (1u << 2) +#define PREF_STRING (1u << 3) +#define PREF_RANGE (1u << 4) +#define PREF_STATIC_TEXT (1u << 5) +#define PREF_UAT (1u << 6) +#define PREF_FILENAME (1u << 7) +#define PREF_COLOR (1u << 8) /* XXX - These are only supported for "internal" (non-protocol) */ +#define PREF_CUSTOM (1u << 9) /* use and not as a generic protocol preference */ +#define PREF_OBSOLETE (1u << 10) +#define PREF_DIRNAME (1u << 11) typedef enum { GUI_ALL, @@ -118,7 +116,7 @@ struct preference { const char *title; /**< title to use in GUI */ const char *description; /**< human-readable description of preference */ int ordinal; /**< ordinal number of this preference */ - pref_type_t type; /**< type of that preference */ + int type; /**< type of that preference */ gui_type_t gui; /**< type of the GUI (QT, GTK or both) the preference is registered for */ union { /* The Qt preference code assumes that these will all be pointers (and unique) */ guint *uint; |