aboutsummaryrefslogtreecommitdiffstats
path: root/wireshark-qt.cpp
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-10-04 11:31:19 +0200
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2015-10-04 15:45:02 +0000
commitc647faa8a90739963ba40a099a365197f90b2184 (patch)
tree779aa416faca634eb3eb5dcd84e8421a75720ce2 /wireshark-qt.cpp
parent49151eb28c421b61a89bd18feb509e9428909b1e (diff)
Fix various memleaks
Found by starting Wireshark within an empty profile, opening Preferences, search for Protocol "IEEE 802.11" (because it has radio buttons), then close everything again. Many fixes are trivial, but the various recent_read_* functions in recent.c were changed to return a boolean such that the result can always be checked even if errno==0. QButtonGroup leak was hinted by Clang Static Analyzer, all other memleaks were found using ASAN/LSan. Change-Id: Ia73f5d4c09d92f22e72377be59e23342f8ad7211 Reviewed-on: https://code.wireshark.org/review/10776 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'wireshark-qt.cpp')
-rw-r--r--wireshark-qt.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/wireshark-qt.cpp b/wireshark-qt.cpp
index 6674631078..acfa7083a3 100644
--- a/wireshark-qt.cpp
+++ b/wireshark-qt.cpp
@@ -740,11 +740,11 @@ DIAG_ON(cast-qual)
/* Read the profile independent recent file. We have to do this here so we can */
/* set the profile before it can be set from the command line parameter */
- recent_read_static(&rf_path, &rf_open_errno);
- if (rf_path != NULL && rf_open_errno != 0) {
+ if (!recent_read_static(&rf_path, &rf_open_errno)) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"Could not open common recent file\n\"%s\": %s.",
rf_path, strerror(rf_open_errno));
+ g_free(rf_path);
}
/* Init the "Open file" dialog directory */
@@ -754,11 +754,11 @@ DIAG_ON(cast-qual)
/* Only the static part of it will be read, as we don't have the gui now to fill the */
/* recent lists which is done in the dynamic part. */
/* We have to do this already here, so command line parameters can overwrite these values. */
- recent_read_profile_static(&rf_path, &rf_open_errno);
- if (rf_path != NULL && rf_open_errno != 0) {
+ if (!recent_read_profile_static(&rf_path, &rf_open_errno)) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"Could not open recent file\n\"%s\": %s.",
rf_path, g_strerror(rf_open_errno));
+ g_free(rf_path);
}
// Initialize our language
@@ -783,11 +783,11 @@ DIAG_ON(cast-qual)
/* Only the static part of it will be read, as we don't have the gui now to fill the */
/* recent lists which is done in the dynamic part. */
/* We have to do this already here, so command line parameters can overwrite these values. */
- recent_read_profile_static(&rf_path, &rf_open_errno);
- if (rf_path != NULL && rf_open_errno != 0) {
+ if (!recent_read_profile_static(&rf_path, &rf_open_errno)) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"Could not open recent file\n\"%s\": %s.",
rf_path, g_strerror(rf_open_errno));
+ g_free(rf_path);
}
if (recent.gui_fileopen_remembered_dir &&
@@ -1347,11 +1347,11 @@ DIAG_ON(cast-qual)
/* Read the dynamic part of the recent file, as we have the gui now ready for
it. */
- recent_read_dynamic(&rf_path, &rf_open_errno);
- if (rf_path != NULL && rf_open_errno != 0) {
+ if (!recent_read_dynamic(&rf_path, &rf_open_errno)) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"Could not open recent file\n\"%s\": %s.",
rf_path, g_strerror(rf_open_errno));
+ g_free(rf_path);
}
color_filters_enable(recent.packet_list_colorize);