aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-04-29 04:28:53 -0700
committerGuy Harris <guy@alum.mit.edu>2017-04-29 11:29:34 +0000
commit2a3f1a4f6724c061f47a0266e157e6d84aa65c7d (patch)
treebdb778c127d6cb73751c7bfc2766a6ba1cecac0d
parente3f49280deb11a7055083634fbbc4d8416fce024 (diff)
Eliminate some double-frees.
The cfile_ error-reporting routines free err_info; the caller doesn't have to and, in fact, mustn't do so themselves. While we're at it, make sure wtap_seek_read() always zeroes out *err and nulls out *err_info, so the latter either points to a freshly-allocated string or is null. Change-Id: Idfe05a3ba2fbf2647ba14e483187617ee53e3c69 Reviewed-on: https://code.wireshark.org/review/21407 Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--capinfos.c5
-rw-r--r--file.c2
-rw-r--r--mergecap.c2
-rw-r--r--tshark.c2
-rw-r--r--wiretap/wtap.c2
5 files changed, 2 insertions, 11 deletions
diff --git a/capinfos.c b/capinfos.c
index f049864673..428093c2c9 100644
--- a/capinfos.c
+++ b/capinfos.c
@@ -1231,11 +1231,6 @@ process_cap_file(wtap *wth, const char *filename)
fprintf(stderr,
" (will continue anyway, checksums might be incorrect)\n");
} else {
- if (err_info != NULL) {
- fprintf(stderr, "(%s)\n", err_info);
- g_free(err_info);
- }
-
cleanup_capture_info(&cf_info);
return 1;
}
diff --git a/file.c b/file.c
index 72771c46be..f5e39f6581 100644
--- a/file.c
+++ b/file.c
@@ -1411,8 +1411,6 @@ cf_merge_files_to_tempfile(gpointer pd_window, char **out_filenamep,
break;
}
- g_free(err_info);
-
cf_callback_invoke(cf_cb_file_merge_finished, NULL);
if (status != MERGE_OK) {
diff --git a/mergecap.c b/mergecap.c
index cac00af45e..e696c0042f 100644
--- a/mergecap.c
+++ b/mergecap.c
@@ -494,8 +494,6 @@ main(int argc, char *argv[])
break;
}
- g_free(err_info);
-
clean_exit:
wtap_cleanup();
free_progdirs();
diff --git a/tshark.c b/tshark.c
index 7fc5938385..071e5d8776 100644
--- a/tshark.c
+++ b/tshark.c
@@ -3317,13 +3317,11 @@ process_cap_file(capture_file *cf, char *save_file, int out_file_type,
/* Error on pass 1 of two-pass processing. */
cfile_read_failure_message("TShark", cf->filename, err_pass1,
err_info_pass1);
- g_free(err_info_pass1);
}
if (err != 0) {
/* Error on pass 2 of two-pass processing or on the only pass of
one-pass processing. */
cfile_read_failure_message("TShark", cf->filename, err, err_info);
- g_free(err_info);
}
success = FALSE;
}
diff --git a/wiretap/wtap.c b/wiretap/wtap.c
index 1b9ab0552a..58a22e9298 100644
--- a/wiretap/wtap.c
+++ b/wiretap/wtap.c
@@ -1403,6 +1403,8 @@ wtap_seek_read(wtap *wth, gint64 seek_off,
phdr->pkt_encap = wth->file_encap;
phdr->pkt_tsprec = wth->file_tsprec;
+ *err = 0;
+ *err_info = NULL;
if (!wth->subtype_seek_read(wth, seek_off, phdr, buf, err, err_info))
return FALSE;