Commit Graph

1891 Commits

Author SHA1 Message Date
Gerald Combs 95382c3afb Suppress a bunch of cast-qual warnings.
Squelch

    warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]

similar to g630f54f.

Change strtod to g_ascii_strtod to squelch a checkAPIs error.

Change-Id: Ib2d26ef89f08827a5adc07e35eaf876cd7b8d14e
Reviewed-on: https://code.wireshark.org/review/7269
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-02-20 04:04:15 +00:00
Guy Harris 9423a13b2d Just have init_progfile_dir() take a void pointer.
dladdr() takes a void * as a code pointer; have init_progfile_dir() do
so, and do the casting in the calls.  We don't care about the signature
of the function whose address we're passing, we just want to pass a
pointer to *something* in the main program.

Change-Id: I9372620a97b0eb53c2bb3c0c41a238b4408f3709
Reviewed-on: https://code.wireshark.org/review/7270
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-20 00:24:08 +00:00
Guy Harris 7263af87c6 Eliminate some DIRTY_ file lists.
We don't want to encourage people to add to those lists, we want to
encourage people to subtract *from* those lists (either by fixing
warnings or, if an infelicitous API, or an infelicitous declaration of
an API on some platforms, or a program generator that doesn't take
sufficient care to avoid warnings - I'm looking at *you*, Flex - makes
it impossible to fix without introducing other problems, using the
DIAG_OFF()/DIAG_ON() macros if possible).  Eliminate the empty lists, to
make it harder to fill them up again.

Change-Id: I298d07952c0cb1842a4ea71ba7e07c68e94a04e9
Reviewed-on: https://code.wireshark.org/review/7229
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-18 08:04:32 +00:00
Guy Harris 859511db14 Make UAT record update callbacks return a success/failure indication.
Have them return TRUE on success and FALSE on failure.  Check the return
value rather than whether the error string pointer is null or not.

Change-Id: I800a03bcd70a6bbb7b217cf7c4800e9cdcf2189c
Reviewed-on: https://code.wireshark.org/review/7222
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-18 00:41:09 +00:00
Michael Mann b2c81bb9e8 Make get_manuf_name return a const string.
Model get_manuf_name after get_ether_name so that a string (either name resolved or colon-separated bytes) is always stored in a hash table.  This will make name resolution of addresses perform a little better because it doesn't have to worry about the wmem_allocator.

Change-Id: If976fe7b0c3f9cd053225096c2ac05418f061af6
Reviewed-on: https://code.wireshark.org/review/7081
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-16 12:47:02 +00:00
Peter Wu 4f3646fe62 Fix handling of invalid UAT items
If the UAT file failed a field check, then the user_data pointer may be
empty. As a result uat_save() triggers an invalid write.

(Discovered while working with a dfilter_macros file having duplicate
names for bug 10957, caught by ASAN.)

The second issue fixed in this patch is that the validity of an item is
only calculated when a new record is added. So even if the user edits
the UAT and makes the entry valid, it would not be saved. This is solved
by adding a new uat_update_record() function which got wires up into GTK
and Qt.

Some open-coded g_array_index and UAT[_USER]_INDEX_PTR are also
converted.

Even after this patch, Qt has some issues with UAT handling. In
particular, it saves new, but empty/invalid, items. It also it does not
check individual fields when saving all fields (unlike Gtk). This patch
focused on getting Gtk fixed first so ignores those existing issues.

Change-Id: Ia35cfe9d2b793c65144ae7e29a1ed706b6668d99
Reviewed-on: https://code.wireshark.org/review/7120
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-15 23:52:24 +00:00
Bill Meier bfde04b845 ui/gtk/*.c: Add editor modelines; As needed: Fix indentation
Change-Id: I8cd9d9fe5f12c284f46b8f725766f681faccd753
Reviewed-on: https://code.wireshark.org/review/7138
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-02-15 19:02:30 +00:00
Gerald Combs e11d7ef08f Fix diagnostics macros and squelch a gcc warning.
Both clang and gcc define __GNUC__. Make sure we account for that when
defining diagnostic macros.

Use DIAG_OFF + DIAG_ON to suppress gcc -pedantic warnings about
frame_data.

Get rid of packet_char_enc casts.

Change-Id: Idbcc61bcdb35c1d20f185461c69451dcdf73bae9
Reviewed-on: https://code.wireshark.org/review/7106
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-02-14 19:46:42 +00:00
Michael Mann 91b5042ece "Hide" hashether_t structure.
One use in a GUI function isn't really enough to justify making the structure public.

Change-Id: Ic7dee275ba0a2bd4e19c06702a867417c5624c27
Reviewed-on: https://code.wireshark.org/review/7080
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-14 15:56:21 +00:00
Bill Meier 9c866ff971 Replace tabs by spaces when editor modelines has "expandtab"
Change-Id: If7a6f2697be732ae4f94ed8b845fd293c32510f7
Also: tabs-stops should be 8
Reviewed-on: https://code.wireshark.org/review/7100
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-02-13 17:34:53 +00:00
Anders Broman 4359cb8478 Revert ""Hide" hashether_t structure."
This reverts commit 297ef07b9b.

Change-Id: Id47f5fd221b631c95ca71e3f9315f5263bab22de
Reviewed-on: https://code.wireshark.org/review/7077
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-12 08:34:30 +00:00
Anders Broman 53228c4bd8 Revert "Make get_manuf_name return a const string."
This reverts commit 797ea88aef.

Change-Id: I9bc2cef0051d88c6374c6f1868b0250cba3edbd4
Reviewed-on: https://code.wireshark.org/review/7076
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-12 08:34:05 +00:00
Michael Mann 797ea88aef Make get_manuf_name return a const string.
Model get_manuf_name after get_ether_name so that a string (either name resolved or colon-separated bytes) is always stored in a hash table.  This will make name resolution of addresses perform a little better because it doesn't have to work about the wmem_allocator.

Change-Id: I80f465ae0845290255a659ab63310ac3cc35506e
Reviewed-on: https://code.wireshark.org/review/7075
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-12 07:36:20 +00:00
Michael Mann 297ef07b9b "Hide" hashether_t structure.
One use in a GUI function isn't really enough to justify making the structure public.

Change-Id: I6d70b9bacbc0fa1898150f59c0c69779a6cd5d51
Reviewed-on: https://code.wireshark.org/review/7074
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-12 07:31:05 +00:00
Bill Meier 3c9c9bc299 capture_dlg.c: Fix (possibly valid) "Using uninitialized memory" MSVC2013 Code Analysis warning
Change-Id: I849b731420d779b68ab4335eb8d06482ecd649e7
Reviewed-on: https://code.wireshark.org/review/7068
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-02-11 17:03:53 +00:00
Kevin Grigorenko 3b2954208a Add a "Sum" column to the Service Response Time (SRT) window.
The Service Response Time (SRT) window currently provides the
columns: Index, Procedure, Calls, Min SRT, Max SRT, and Avg SRT.
A Sum column has been found useful in some customer situations
to understand the total time spent doing a set of procedures.
For example, in one case we were trying to isolate whether most
time was being spent on a client thread or in the act of making
outbound calls. We knew the start and end time of the client call,
so with the "Sum" of time spent in that period, we could isolate
a particular set of procedures driving the slow down.

Additional changes made in this patch:
* Add " (s)" to Min, Max, Avg, and Sum columns to make it clear
  that times are in seconds.
* Refactor out width and height constants used in calls to
  gtk_window_set_default_size in most of the SRT users into
  #define SRT_PREFERRED_WIDTH and SRT_PREFERRED_HEIGHT. Also
  increase the common width of 550 to 650 to account for the
  additional column.

Change-Id: I20f152eecbcd0bbf69f71c6c6b9f9463e8867e23
Reviewed-on: https://code.wireshark.org/review/7047
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-10 06:18:41 +00:00
Bill Meier e88a11f5c9 (Trivial) Fix printf-related 'Mismatch on sign' warnings
Found by MSVC2013 Code Analysis

Change-Id: I58063946dd558e98308c87b36eeac0ddbe1a6e79
Reviewed-on: https://code.wireshark.org/review/7045
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-02-09 18:57:14 +00:00
Peter Wu 702618fa61 Fix use-after free in RTP player
Clicking "Decode" in the RTP player triggered an ASAN
heap-use-after-free in update_progress_bar(). Explicitly set
progress_bar to NULL to prevent this.

Change-Id: Ice3105a11642a1cc5a54b8fbdf7dbf0ed430d965
Ping-Bug: 10714
Reviewed-on: https://code.wireshark.org/review/6999
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-09 05:26:29 +00:00
Alexis La Goutte 58f8076fad Menubar (GTK): fix warning: no previous prototype for ‘set_menus_capture_start_sensitivity’ [-Wmissing-prototypes]
Change-Id: I11c805b285d277ecb963622385154c310f6d1c67
Reviewed-on: https://code.wireshark.org/review/7032
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-08 22:34:03 +00:00
Alexis La Goutte 0310132a82 Multicast Stream: Move mcast_stream.[ch] to ui
Preparation to add Multicast Stream Dialog on Qt (Add extern C...)

Change-Id: Ic8bc39a18dba607d6da116df799de7847ce8e4c8
Reviewed-on: https://code.wireshark.org/review/6984
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-08 22:22:33 +00:00
Peter Wu 2c65b33b21 Fix RTP crash on RTP analysis attempt
The tap listener was handling rtpstream_tapinfo_t* types while other
users was expecting a GList* instead. Fix this and avoid future
confusion by replacing void* pointers.

Ping-Bug: 10714
Change-Id: I66f62eaaed4a529714264bbf4e7ad1e72b46ce5a
Reviewed-on: https://code.wireshark.org/review/6997
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-02-07 02:16:06 +00:00
Alexis La Goutte 8b095bc25e Multicast Stream (GTK): fix crash when try to select a stream
Change-Id: Iaaa9445ae99b37cfb1865251d50f38375f3eb272
Reviewed-on: https://code.wireshark.org/review/6985
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-06 16:19:40 +00:00
Alexis La Goutte 0f353c9cc4 HTTP2: Add tap for HTTP2 dissector
Change-Id: Ib13d9391b64dad19321a4399c95b95d7fb791284
Reviewed-on: https://code.wireshark.org/review/6421
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-02-04 07:09:49 +00:00
Michael Mann 90a76e0d51 Convert val_to_str -> val_to_str_wmem.
This is mostly for GUI usage, but a few dissectors needed some "non-packet scope" conversions.

val_to_str officially now uses wmem_packet_scope()

Change-Id: Ic9413eeb3406d7a7683222b86709f3675d628d81
Reviewed-on: https://code.wireshark.org/review/6933
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-04 06:58:49 +00:00
Gerald Combs 89e6f4c468 Qt: Add the Protocol Hierarchy statistics dialog.
Change-Id: I6872e323daca4798c638d764873f54c4c0dc0006
Reviewed-on: https://code.wireshark.org/review/6934
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-02-04 02:06:01 +00:00
Michael Mann b635997624 Convert val_to_str_ext -> val_to_str_ext_wmem for calls that don't have valid packet scope (GUI).
val_to_str_ext now officially uses wmem_packet_scope().

Removed const from val_to_str[_ext]_wmem return value since it's not really constant.

Created utility functions in qt_ui_utils.h to help with the new memory management for its GUI.

Change-Id: Idf2ce4a4ce78d628b2269ad23a3a48fbfc9c077c
Reviewed-on: https://code.wireshark.org/review/6926
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-03 13:03:32 +00:00
Alexis La Goutte 003e3373f5 Fix some indent typo (after g2bf7878e)
Change-Id: I44769f127f32ffd8a97b1579f371501f4aa9832a
Reviewed-on: https://code.wireshark.org/review/6913
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-02 12:37:06 +00:00
Guy Harris 3947091a50 Fix a typo.
Change-Id: I2724340e41572fdaa56ebf75478297090563c522
Reviewed-on: https://code.wireshark.org/review/6895
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-01 21:03:13 +00:00
Guy Harris cca2cde68e No main window *to* update in the early argument list parsing.
We haven't yet popped the main window up, so, when we call
capture_interface_list(), we shouldn't pass a pointer to the "update the
main window" routine.

Change-Id: Id3e02199479e66bb9e9aff99b435bd03af45a1af
Reviewed-on: https://code.wireshark.org/review/6868
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-31 04:03:58 +00:00
Gerald Combs 2bf7878e8a Qt: Add the RTP Streams dialog.
Add keyboard shortcuts. Note that not all of the buttons made it from
GTK+.  Add a "Go to setup frame" option.

Move rtp_streams.c from ui/gtk to ui.

Add a help URL for RTP analysis (which needs to be split into streams +
analysis).

Fix RTP stream packet marking.

Change-Id: Ifb8192ff701a933422509233d76461a46e459f4f
Reviewed-on: https://code.wireshark.org/review/6852
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-01-30 06:48:32 +00:00
Alexis La Goutte 83678a05ea Proto dialog (GTK) : fix indent (use 2 spaces) and add modelines
Change-Id: I36945843b8d544188a3ffe89f397e669f3944593
Reviewed-on: https://code.wireshark.org/review/6831
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-28 12:46:31 +00:00
Dario Lombardo 9bbc337306 Added HPFEEDS stats_tree.
Change-Id: I256fd5395b062fa954ebd60598721323ea1d7ff1
Bug: 10875
Reviewed-on: https://code.wireshark.org/review/6713
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-27 13:19:20 +00:00
Alexis La Goutte 77227d40bf GTK: Fix multispace on main title bar
Change-Id: I275a586c16621fdfabede23f6a1d03c8d8556b3f
Reviewed-on: https://code.wireshark.org/review/6813
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-27 12:45:27 +00:00
Alexis La Goutte ec7ff4e25d GTK: fix no previous prototype for ... [-Wmissing-prototypes]
Add by commit g43f09e67b (Remove unneeded includes from ui folder)

Change-Id: I66eb113430bde97e18bb3d2b00f6bac46a01797e
Reviewed-on: https://code.wireshark.org/review/6809
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-27 12:37:10 +00:00
Alexis La Goutte a9aba9408b GTK: fix no previous prototype for ... [-Wmissing-prototypes]
Add by commit g43f09e67b (Remove unneeded includes from ui folder)

Change-Id: I7c9d9e2bbd76d062f96422c74ee8eb8c6ecd328b
Reviewed-on: https://code.wireshark.org/review/6808
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-27 12:35:39 +00:00
Guy Harris e601e01ffd Remove some apparently-unnecessary includes of emem.h.
Also update a comment to no longer speak of ep_ allocation, and add an
include of <glib.h> to ui/profile.c, which was formerly relying on the
include of emem.h to drag it in.

Change-Id: I08926699ee96cf66672836b6ee3bbb405b507ce8
Reviewed-on: https://code.wireshark.org/review/6633
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-18 19:47:20 +00:00
Guy Harris cfcbb28671 Clean up ftype-conversion and dfilter error message string handling.
Have dfilter_compile() take an additional gchar ** argument, pointing to
a gchar * item that, on error, gets set to point to a g_malloc()ed error
string.  That removes one bit of global state from the display filter
parser, and doesn't impose a fixed limit on the error message strings.

Have fvalue_from_string() and fvalue_from_unparsed() take a gchar **
argument, pointer to a gchar * item, rather than an error-reporting
function, and set the gchar * item to point to a g_malloc()ed error
string on an error.

Allow either gchar ** argument to be null; if the argument is null, no
error message is allocated or provided.

Change-Id: Ibd36b8aaa9bf4234aa6efa1e7fb95f7037493b4c
Reviewed-on: https://code.wireshark.org/review/6608
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-18 10:22:59 +00:00
Michael Mann a1f2342e13 Miscellaneous ep_strdup_printf replacement.
Change-Id: I973c672e9d573ad67e9b9fd82a5610aaf8a74efa
Reviewed-on: https://code.wireshark.org/review/6605
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-18 04:15:18 +00:00
Michael Mann 403be722ce Remove emem from GeoIP
Change-Id: Ifa96dc38a277b86c28f762489251dcc595afae67
Reviewed-on: https://code.wireshark.org/review/6603
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-18 04:14:03 +00:00
Michael Mann 77dac91eb0 A few more emem replacements with wmem.
Change-Id: Icfb319fba937642db637a7f26b5e7627461df3b0
Reviewed-on: https://code.wireshark.org/review/6590
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-17 21:05:58 +00:00
Michael Mann 5c5b3f7d26 Convert proto_construct_match_selected_string to use wmem.
Change-Id: I7a40c0996517aa71b4ddb764ce3a6e92a55260ad
Reviewed-on: https://code.wireshark.org/review/6589
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-17 21:04:22 +00:00
Michael Mann 531df02736 Remove se_ alloced memory from packet_list_store
Change-Id: I7aa2f5f8b433468ad2c2cd73cfce986d128a9ae0
Reviewed-on: https://code.wireshark.org/review/6565
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-16 16:03:58 +00:00
Michael Mann ada1eec702 SE_COPY_ADDRESS -> WMEM_COPY_ADDRESS
Copy addresses with wmem-scope instead of (forced) seasonal scope.  All existing instances were converted to wmem_file_scope, but the flexibility is there for other scopes.

Change-Id: I8e58837b9ef574ec7dd87e278470d7063ae8c1c2
Reviewed-on: https://code.wireshark.org/review/6564
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-16 15:25:18 +00:00
Michael Mann e530c89940 Replace se alloced memory in compare stat tap.
Also replaced comments mentioning se_alloc memory with wmem_file_scope, since it's more accurate.

It seems that many of the TShark stat taps may be leaking memory, because the hash tables created by the taps don't get a chance to be freed.  Somewhat academic since TShark exits shortly after displaying any stats, but a leak none the less.

Change-Id: I8ceecbd00d65b3442dc02d720b39c2e15aa0c8a6
Reviewed-on: https://code.wireshark.org/review/6557
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-16 00:37:02 +00:00
Michael Mann d5ee022b9e Replace C++ style comment with C style.
Change-Id: Ibee0dccdb5a330866dcd0047216cd5a4da45fc8b
Reviewed-on: https://code.wireshark.org/review/6559
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-15 20:10:52 +00:00
Jeff Morriss 6f630c10a5 Fix the compile: Use the new (double) variable.
Change-Id: I38a9b0f55e9f19fe7f4f09f5eec2817dd822c6d0
Reviewed-on: https://code.wireshark.org/review/6542
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2015-01-15 02:05:43 +00:00
Gerald Combs b63a942c4b Fix a crash in the GTK+ RTP Streams dialog.
Make sure we copy guint, gdouble, and gchar * data to variables of the
correct type. Fixes a crash when trying to copy CSV data (we were trying
to stuff a gdouble into a char *).

Change-Id: I3cbcc48216a078f85f13860d14707f309b9820d7
Reviewed-on: https://code.wireshark.org/review/6541
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-01-15 00:59:02 +00:00
Guy Harris 63a3d043e3 Consistently use the "g_string_free returns a C string pointer" idiom.
g_string_free(str, FALSE) frees the GString container but not the
underlying g_malloc()ed string; instead, it returns a pointer to the
g_malloc()ed string.

Fix those places that didn't already get the string pointer from
g_string_free() to do so rather than manually extracting the string
themselves.

And fix one place that didn't even need to use a string - it was just
scanning a C string without even modifying it.

Change-Id: Ibbf4872bf5b9935b9907f539b6edb1013f3053a5
Reviewed-on: https://code.wireshark.org/review/6532
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-13 23:14:13 +00:00
Guy Harris 9f5e4fb7a5 uat_load() and uat_save() return a success indication; use it.
Instead of always ignoring the return value, always check it, and only
report an error if it returns FALSE.

(Alternative: have it return NULL on success and a pointer to a
g_malloc()ed string on failure.)

Fix a comment while we're at it.

Change-Id: Icb72c9f47775b6552e3eb4fe5ddcc85482bfb5fb
Reviewed-on: https://code.wireshark.org/review/6528
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-13 21:01:28 +00:00
Guy Harris bc23f79729 UAT error string pointers should not be const pointers.
UAT error strings are usually allocated by g_strdup() or
g_strdup_printf(), and must ultimately be freed by the caller.

Make the pointer-to-error-string-pointer arguments to various functions
be "char **", not "const char **".

Fix cases that finds where a raw string was being used, as that won't
work if you try to free it; g_strdup() it instead.

Add a missing free of an error string.

Remove some no-longer-necessary casts.

Remove some unnecessary g_strdup()s (the string being handed to it was
already g_malloc()ated).

Change some variable declarations to match.

Put in XXX comments for some cases where the error string is just freed,
without being shown to the user.

Change-Id: I40297746a2ef729c56763baeddbb0842386fa0d0
Reviewed-on: https://code.wireshark.org/review/6525
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-13 20:20:03 +00:00